Skip to content

Conversation

@himaniraghav3
Copy link
Collaborator

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/PM-3456

What's in this PR?

For admin, pm and tm:

image

For self:

image


const roles = props.authProfile?.roles || []

const isPrivilegedViewer

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

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))

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.

@himaniraghav3 himaniraghav3 merged commit 40a8455 into dev Jan 28, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants