-
Notifications
You must be signed in to change notification settings - Fork 1
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
MPDX-7865 Rename Contact Statuses #898
base: main
Are you sure you want to change the base?
Conversation
…once Caleb has done his work
This pull request is automatically being deployed by Amplify Hosting (learn more). |
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.
I left some comments. I know this is still in review, so I didn't highlight everything.
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.
I see several TODOs left, but what you have looks pretty good so far!
...ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.test.tsx
Show resolved
Hide resolved
src/components/Contacts/MassActions/EditFields/MassActionsEditFieldsModal.tsx
Show resolved
Hide resolved
src/components/Task/Modal/Form/Inputs/TagsAutocomplete/TagsAutocomplete.tsx
Show resolved
Hide resolved
}, [activity]); | ||
|
||
return [phaseData, setActivity]; | ||
}; |
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.
Since it seems that activity is only being used for the useEffect
, I think it might be cleaner to remove the activity
useState
and return a setActivity
function. I think it's also better to return an object from the hook instead of a tuple so that it's super clear what each of the members are.
const phaseFromActivity = (
activity: PhaseTypeEnum | null,
): ContactPhaseData | null => {
if (activity) {
return (
allPhaseData.find((phase) => phase.phase === activity.toLowerCase()) ??
null
);
}
return null;
};
export const useGetPhaseData = (
activityId: PhaseTypeEnum | null,
): UseGetPhaseData => {
const [phaseData, setPhaseData] = useState<ContactPhaseData | null>(
phaseFromActivity(activityId),
);
const setActivity = useCallback((activity: PhaseTypeEnum | null) => {
setPhaseData(phaseFromActivity(activity));
}, []);
return { phaseData, setActivity };
};
Description
https://jira.cru.org/secure/RapidBoard.jspa?rapidView=3&view=detail&selectedIssue=MPDX-7865#
Checklist: