Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed null values from profile #121

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 40 additions & 20 deletions src/components/UserProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export const UserDetails = ({
placeholder='Your name'
>
<h2 className='user-profile-name'>
{user.Name ? user.Name : user.username}
{user.Name
? user.Name === 'null'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have null as string? @SundeepChand do you have any idea?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, looks like this == 'null' comparison is being used in multiple places, let's make a function for it and use it everywhere

? user.username
: user.Name
: user.username}
</h2>
</EditableLabel>
<EditableLabel
Expand All @@ -122,7 +126,7 @@ export const UserDetails = ({
placeholder='Say something about yourself'
>
<p>
{user.Bio ||
{(user.Bio && user.Bio !== 'null') ||
(allowEditing ? 'Say something about yourself' : 'Hi There!')}
</p>
</EditableLabel>
Expand All @@ -147,7 +151,11 @@ export const UserDetails = ({
placeholder='Your job title'
>
<span>
{!user.Profession ? 'Your job title' : user.Profession}
{!user.Profession
? 'Your job title'
: user.Profession === 'null'
? 'Your job title'
: user.Profession}
</span>
</EditableLabel>
</li>
Expand All @@ -165,7 +173,11 @@ export const UserDetails = ({
placeholder='Your company name'
>
<span>
{!user.Company ? 'Your company name' : user.Company}
{!user.Company
? 'Your company name'
: user.Company === 'null'
? 'Your company name'
: user.Company}
</span>
</EditableLabel>
</li>
Expand All @@ -184,14 +196,18 @@ export const UserDetails = ({
>
<span>
{user.LinkedIn ? (
<a
className='link link-default'
href={`https://www.linkedin.com/in/${user?.LinkedIn}`}
target='_blank'
rel='noopener noreferrer'
>
{user.LinkedIn}
</a>
user.LinkedIn === 'null' ? (
'Your LinkedIn username'
) : (
<a
className='link link-default'
href={`https://www.linkedin.com/in/${user?.LinkedIn}`}
target='_blank'
rel='noopener noreferrer'
>
{user.LinkedIn}
</a>
)
) : (
'Your LinkedIn username'
)}
Expand All @@ -213,14 +229,18 @@ export const UserDetails = ({
>
<span>
{user.Twitter ? (
<a
className='link link-default'
href={`https://twitter.com/${user?.Twitter}`}
target='_blank'
rel='noopener noreferrer'
>
{user.Twitter ? `@${user.Twitter}` : ''}
</a>
user.Twitter === 'null' ? (
'Your Twitter handle'
) : (
<a
className='link link-default'
href={`https://twitter.com/${user?.Twitter}`}
target='_blank'
rel='noopener noreferrer'
>
{user.Twitter ? `@${user.Twitter}` : ''}
</a>
)
) : (
'Your Twitter handle'
)}
Expand Down