diff --git a/src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/ApplyOpportunityModal.tsx b/src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/ApplyOpportunityModal.tsx index ed355f305..27acf2830 100644 --- a/src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/ApplyOpportunityModal.tsx +++ b/src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/ApplyOpportunityModal.tsx @@ -44,8 +44,8 @@ const ApplyOpportunityModal: FC = props => { size='lg' title={ success - ? `Your Application for ${props.projectName} Has Been Received!` - : `Confirm Your Copilot Application for ${props.projectName}` + ? 'Your Application Has Been Received!' + : 'Confirm Your Copilot Application' } buttons={ !success ? ( @@ -62,21 +62,21 @@ const ApplyOpportunityModal: FC = props => {
{ success - ? `We appreciate the time and effort you've taken to apply - for this exciting opportunity. Our team is committed - to providing a seamless and efficient process to ensure a - great experience for all copilots. We will review your application - within short time.` + ? `Thank you for taking the time to apply for this exciting opportunity. + We truly value your interest and effort. + Your application will be reviewed promptly.` : `We're excited to see your interest in joining our team as a copilot - for the ${props.projectName} project! Before we proceed, we want to + for the "${props.projectName}" project! Before we proceed, we want to ensure that you have carefully reviewed the project requirements and - are committed to meeting them.` + are committed to meeting them. Please write below the reason(s) + why you believe you're a good fit for this project + (e.g., previous experience, availability, etc.).` }
{ !success && ( = () => { const onApplied: () => void = useCallback(() => { mutate(`${copilotBaseUrl}/copilots/opportunity/${opportunityId}/applications`) - mutate(`${copilotBaseUrl}/copilots/opportunity/${opportunityId}`) + mutate(`${copilotBaseUrl}/copilot/opportunity/${opportunityId}`) }, []) const onCloseApplyModal: () => void = useCallback(() => { @@ -120,11 +122,26 @@ const CopilotOpportunityDetails: FC<{}> = () => { ) } + async function cancelCopilotOpportunityHandler(): Promise { + if (opportunityId) { + await cancelCopilotOpportunity(opportunityId) + mutate(`${copilotBaseUrl}/copilots/opportunity/${opportunityId}/applications`) + mutate(`${copilotBaseUrl}/copilot/opportunity/${opportunityId}`) + toast.success('Canceled copilot opportunity successfully') + } + + } + const applyCopilotOpportunityButton: ButtonProps = { label: 'Apply as Copilot', onClick: () => setShowApplyOpportunityModal(true), } + const cancelCopilotOpportunityButton: ButtonProps = { + label: 'Cancel opportunity', + onClick: cancelCopilotOpportunityHandler, + } + const application = copilotApplications && copilotApplications[0] const getOpportunityType = (type: string): ProjectType => { @@ -152,6 +169,10 @@ const CopilotOpportunityDetails: FC<{}> = () => { && opportunity?.status === 'active' && opportunity?.canApplyAsCopilot ? applyCopilotOpportunityButton : undefined } + secondaryButtonConfig={ + opportunity?.status === 'active' + && isAdminOrPM ? cancelCopilotOpportunityButton : undefined + } infoComponent={(isCopilot && !(copilotApplications && copilotApplications.length === 0 ) && opportunity?.status === 'active' && !!application) && ( @@ -171,98 +192,101 @@ const CopilotOpportunityDetails: FC<{}> = () => { {isValidating && !showNotFound && ( ) } -

- {opportunity?.projectName} -

-
-
- -
- Status - {opportunity?.status} +
+

+ {opportunity?.projectName} +

+
+
+ +
+ Status + {opportunity?.status} +
-
-
- -
- Start Date - - {moment(opportunity?.startDate) - .format('MMM D, YYYY')} +
+ +
+ Start Date + + {moment(opportunity?.startDate) + .format('MMM D, YYYY')} - + +
-
-
- -
- Duration - - {opportunity?.numWeeks} - {' '} - weeks - +
+ +
+ Duration + + {opportunity?.numWeeks} + {' '} + weeks + +
-
-
- -
- Hours - - {opportunity?.numHoursPerWeek} - {' '} - hours/week - +
+ +
+ Hours + + {opportunity?.numHoursPerWeek} + {' '} + hours/week + +
-
-
- -
- Type - - {opportunity?.type && getOpportunityType(opportunity?.type)} - +
+ +
+ Type + + {opportunity?.type && getOpportunityType(opportunity?.type)} + +
-
-
- -
- Working Hours - {opportunity?.tzRestrictions} +
+ +
+ Working Hours + {opportunity?.tzRestrictions} +
-
- { - initialized && ( - + ) + } + {activeTab === CopilotDetailsTabViews.details && } + {activeTab === CopilotDetailsTabViews.applications && isAdminOrPM && opportunity && ( + - ) - } - {activeTab === CopilotDetailsTabViews.details && } - {activeTab === CopilotDetailsTabViews.applications && isAdminOrPM && opportunity && ( - - )} + )} + + { + showApplyOpportunityModal + && opportunity && ( + + ) + } +
- { - showApplyOpportunityModal - && opportunity && ( - - ) - } ) } diff --git a/src/apps/copilots/src/pages/copilot-opportunity-details/styles.module.scss b/src/apps/copilots/src/pages/copilot-opportunity-details/styles.module.scss index 8bb4b5162..9844231ae 100644 --- a/src/apps/copilots/src/pages/copilot-opportunity-details/styles.module.scss +++ b/src/apps/copilots/src/pages/copilot-opportunity-details/styles.module.scss @@ -1,5 +1,9 @@ @import '@libs/ui/styles/includes'; +.wrapper { + min-height: 800px; +} + .header { display: flex; align-items: center; diff --git a/src/apps/copilots/src/pages/copilot-opportunity-details/tabs/copilot-applications/CopilotApplicationAction.tsx b/src/apps/copilots/src/pages/copilot-opportunity-details/tabs/copilot-applications/CopilotApplicationAction.tsx index 836678036..bcf228fc5 100644 --- a/src/apps/copilots/src/pages/copilot-opportunity-details/tabs/copilot-applications/CopilotApplicationAction.tsx +++ b/src/apps/copilots/src/pages/copilot-opportunity-details/tabs/copilot-applications/CopilotApplicationAction.tsx @@ -15,7 +15,8 @@ const CopilotApplicationAction = ( ): JSX.Element => { const { opportunityId }: {opportunityId?: string} = useParams<{ opportunityId?: string }>() const isInvited = useMemo( - () => allCopilotApplications.findIndex(item => item.status === CopilotApplicationStatus.INVITED) > -1, + () => allCopilotApplications + && allCopilotApplications.findIndex(item => item.status === CopilotApplicationStatus.INVITED) > -1, [allCopilotApplications], ) const onClick = useCallback(async () => { diff --git a/src/apps/copilots/src/pages/copilot-opportunity-details/tabs/opportunity-details/OpportunityDetails.tsx b/src/apps/copilots/src/pages/copilot-opportunity-details/tabs/opportunity-details/OpportunityDetails.tsx index 847dbc6c9..8cd3afd44 100644 --- a/src/apps/copilots/src/pages/copilot-opportunity-details/tabs/opportunity-details/OpportunityDetails.tsx +++ b/src/apps/copilots/src/pages/copilot-opportunity-details/tabs/opportunity-details/OpportunityDetails.tsx @@ -11,11 +11,8 @@ const OpportunityDetails: FC<{

Required skills

- {props.opportunity?.skills.map((skill: any) => ( -
- {skill.name} -
- ))} + {props.opportunity?.skills.map(item => item.name) + .join(',')}

Description

diff --git a/src/apps/copilots/src/pages/copilot-opportunity-list/index.tsx b/src/apps/copilots/src/pages/copilot-opportunity-list/index.tsx index 21f703b84..8e37b687a 100644 --- a/src/apps/copilots/src/pages/copilot-opportunity-list/index.tsx +++ b/src/apps/copilots/src/pages/copilot-opportunity-list/index.tsx @@ -84,6 +84,11 @@ const tableColumns: TableColumn[] = [ propertyName: 'startDate', type: 'date', }, + { + label: 'Duration(Weeks)', + propertyName: 'numWeeks', + type: 'text', + }, { label: 'Complexity', propertyName: 'complexity', diff --git a/src/apps/copilots/src/pages/copilot-request-form/index.tsx b/src/apps/copilots/src/pages/copilot-request-form/index.tsx index 79aa395ee..8fec31503 100644 --- a/src/apps/copilots/src/pages/copilot-request-form/index.tsx +++ b/src/apps/copilots/src/pages/copilot-request-form/index.tsx @@ -20,7 +20,6 @@ const CopilotRequestForm: FC<{}> = () => { const [formValues, setFormValues] = useState({}) const [isFormChanged, setIsFormChanged] = useState(false) const [formErrors, setFormErrors] = useState({}) - const [existingCopilot, setExistingCopilot] = useState('') const [paymentType, setPaymentType] = useState('') const projectTypes = ProjectTypes ? ProjectTypes.map(project => ({ @@ -29,16 +28,6 @@ const CopilotRequestForm: FC<{}> = () => { })) : [] - function exisitingCopilotToggle(t: 'yes'|'no'): void { - setExistingCopilot(t) - setFormErrors((prevFormErrors: any) => { - const updatedErrors = { ...prevFormErrors } - delete updatedErrors.existingCopilot - return updatedErrors - }) - setIsFormChanged(true) - } - function togglePaymentType(t: 'standard'|'other'): void { setFormValues((prevFormValues: any) => ({ ...prevFormValues, @@ -141,12 +130,6 @@ const CopilotRequestForm: FC<{}> = () => { const fieldValidations: { condition: boolean; key: string; message: string }[] = [ { condition: !formValues.projectId, key: 'projectId', message: 'Project is required' }, - { condition: !existingCopilot, key: 'existingCopilot', message: 'Selection is required' }, - { - condition: existingCopilot === 'yes' && !formValues.copilotUsername, - key: 'copilotUsername', - message: 'Username is required', - }, { condition: !formValues.complexity, key: 'complexity', message: 'Selection is required' }, { condition: !formValues.requiresCommunication, @@ -220,7 +203,6 @@ const CopilotRequestForm: FC<{}> = () => { toast.success('Copilot request sent successfully') setFormValues({ complexity: '', - copilotUsername: '', numHoursPerWeek: '', numWeeks: '', otherPaymentType: '', @@ -234,7 +216,6 @@ const CopilotRequestForm: FC<{}> = () => { }) setIsFormChanged(false) setFormErrors({}) - setExistingCopilot('') setPaymentType('') }) .catch(e => { @@ -288,63 +269,6 @@ const CopilotRequestForm: FC<{}> = () => { dirty error={formErrors.projectId} /> -

- Are you already working with a copilot that you'd love to work with on this project - as well? -

- -
- - -
- { - existingCopilot === 'yes' - && ( -
-

- Great! What is the username of the copilot you'd like to work with again? -

- - -
- ) - } - {formErrors.existingCopilot && ( -

- - {formErrors.existingCopilot} -

- )} - {formValues.existingCopilot === 'yes' && !formValues.copilotUsername && ( -

- - {formErrors.existingCopilot} -

- )}

What type of project are you working on?

=> { + const url = `${copilotBaseUrl}/copilots/opportunity/${opportunityId}/cancel` + + return xhrDeleteAsync(url) +} + /** * Custom hook to fetch copilot applications by opportunity id. *