-
Notifications
You must be signed in to change notification settings - Fork 21
PM-3456 Open to work indicator #1427
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
Conversation
|
|
||
| const roles = props.authProfile?.roles || [] | ||
|
|
||
| const isPrivilegedViewer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[💡 readability]
The variable isPrivilegedViewer is defined using a combination of negation and logical operators, which can be difficult to read and understand at a glance. Consider refactoring to improve readability, such as by using a positive condition or extracting the logic into a well-named function.
| // Showing only when they can edit until we have the talent search app | ||
| // and enough data to make this useful | ||
| canEdit ? renderOpenForWork() : undefined | ||
| canEdit || isPrivilegedViewer ? renderOpenForWork() : undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[💡 style]
The conditional expression canEdit || isPrivilegedViewer ? renderOpenForWork() : undefined could be simplified by using a short-circuit evaluation: canEdit || isPrivilegedViewer && renderOpenForWork(). This would make the code more concise and potentially easier to read.
| const ProfileCompleteness: FC<ProfileCompletenessProps> = props => { | ||
| const completeness = useProfileCompleteness(props.profile.handle) | ||
| const completed = completeness.percent | ||
| const completed = Number(completeness.percent?.toFixed(2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗ correctness]
The use of Number(completeness.percent?.toFixed(2)) could potentially lead to NaN if completeness.percent is null or undefined. Consider providing a default value to handle such cases, e.g., Number(completeness.percent?.toFixed(2) || 0). This ensures completed is always a valid number.
Related JIRA Ticket:
https://topcoder.atlassian.net/browse/PM-3456
What's in this PR?
For admin, pm and tm:
For self: