Skip to content

PM-4182 tweaks for open to work status#1513

Merged
vas3a merged 2 commits intodevfrom
PM-4182_open-to-work-tweaks
Mar 5, 2026
Merged

PM-4182 tweaks for open to work status#1513
vas3a merged 2 commits intodevfrom
PM-4182_open-to-work-tweaks

Conversation

@vas3a
Copy link
Collaborator

@vas3a vas3a commented Mar 5, 2026

Related JIRA Ticket:

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

What's in this PR?

Update the Open to Work section as follows:

  • For members with "Open to Work" unchecked → set status to Unknown.
  • For members with "Open to Work" checked but no preference traits → set status to Unknown.
  • For members with "Open to Work" checked and preference traits defined → no change.

Replace the checkbox with a radio button offering two options:

  • Yes, I'm open to work
  • No, I'm not open to work

Rename the section to Engagement Status.
image
image
image
image

@vas3a vas3a requested review from jmgasper and kkartunov as code owners March 5, 2026 10:13
= useState<boolean>(false)

const openForWork = props.profile.availableForGigs
const openForWork = props.isOpenToWork
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The variable openForWork is now directly assigned from props.isOpenToWork. Ensure that props.isOpenToWork is always correctly initialized and updated, as any null or incorrect value could lead to unexpected UI behavior.

{openForWork ? 'open to work' : 'not open to work'}
</p>
{openForWork === null ? (
<p className={classNames('body-main-bold', styles.unknownOopenToWork)}>
Copy link

Choose a reason for hiding this comment

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

[💡 style]
The class name styles.unknownOopenToWork appears to have a typo with 'Oopen'. Verify the class name in the CSS module to ensure it matches the intended styling.

onClose: () => void
onSave: () => void
profile: UserProfile
openForWork: boolean | null
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The openForWork prop is defined as boolean | null, but it is used directly in the component without handling the null case. Consider providing a default value or handling the null case to avoid potential runtime errors.

const [formValue, setFormValue] = useState<OpenToWorkData>({
availability: undefined,
availableForGigs: !!props.profile.availableForGigs,
availableForGigs: props.openForWork,
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The availableForGigs field in the formValue state is directly assigned from props.openForWork, which can be null. Ensure that formValue.availableForGigs is always a boolean to prevent potential issues in components relying on this state.

...prev,
availability: openToWorkItem?.availability,
availableForGigs: !!props.profile.availableForGigs,
availableForGigs: props.openForWork,
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
Similar to the initialization, the availableForGigs field is updated with props.openForWork, which might be null. Ensure that this field is consistently a boolean to maintain predictable behavior.

(item: UserTrait) => !!item?.openToWork,
)

const isOpenToWork = hasOpenToWork ? props.profile.availableForGigs : null
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The variable isOpenToWork is set to null when hasOpenToWork is false. Consider explicitly handling this case where isOpenToWork might be null in the OpenForGigs component to avoid potential runtime errors or unexpected behavior.

zip?: string
}>
availableForGigs?: boolean,
availableForGigs?: boolean | null,
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
Changing availableForGigs to boolean | null is a significant change. Ensure that all parts of the codebase that handle this property are updated to correctly handle null values. This change could impact logic that assumes a boolean value.

flex: 1;
}

@include ltemd {
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
Ensure that the ltemd mixin is defined and correctly imported. If this mixin is not defined, it could lead to a compilation error.


export interface OpenToWorkData {
availableForGigs: boolean
availableForGigs: boolean | null
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
Changing availableForGigs to boolean | null introduces a third state which may not be handled correctly in all parts of the code. Ensure that all logic considering availableForGigs accounts for the null state to avoid potential bugs.

const OpenToWorkForm: FC<OpenToWorkFormProps> = (props: OpenToWorkFormProps) => {
function toggleOpenForWork(): void {
function handleOpenForWorkChange(e: ChangeEvent<HTMLInputElement>): void {
const openForWork = e.target.value === 'true'
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The comparison e.target.value === 'true' relies on string comparison which can be error-prone if the input values change. Consider using a more robust method to parse the boolean value, such as JSON.parse(e.target.value).

@vas3a vas3a merged commit e0bfe3f into dev Mar 5, 2026
8 checks passed
@vas3a vas3a deleted the PM-4182_open-to-work-tweaks branch March 5, 2026 10:52
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.

1 participant