From 92d56f778d5861a99782c551557580d172fab273 Mon Sep 17 00:00:00 2001 From: Hentry Martin Date: Tue, 6 May 2025 17:27:57 +0200 Subject: [PATCH 1/7] feat: apply for copilot opportunity --- .../copilots/src/models/CopilotApplication.ts | 6 ++ .../ApplyOpportunityModal.tsx | 63 +++++++++++++++++++ .../apply-opportunity-modal/index.ts | 1 + .../styles.module.scss | 7 +++ .../copilot-opportunity-details/index.tsx | 29 ++++++++- .../src/services/copilot-opportunities.ts | 52 +++++++++++++-- .../profile-factory/user-role.enum.ts | 3 +- 7 files changed, 153 insertions(+), 8 deletions(-) create mode 100644 src/apps/copilots/src/models/CopilotApplication.ts create mode 100644 src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/ApplyOpportunityModal.tsx create mode 100644 src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/index.ts create mode 100644 src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/styles.module.scss diff --git a/src/apps/copilots/src/models/CopilotApplication.ts b/src/apps/copilots/src/models/CopilotApplication.ts new file mode 100644 index 000000000..750007b94 --- /dev/null +++ b/src/apps/copilots/src/models/CopilotApplication.ts @@ -0,0 +1,6 @@ +export interface CopilotApplication { + id: number, + notes?: string, + createdAt: Date, + opportunityId: string, +} \ No newline at end of file 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 new file mode 100644 index 000000000..3a2f493b4 --- /dev/null +++ b/src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/ApplyOpportunityModal.tsx @@ -0,0 +1,63 @@ +import { FC, useCallback, useState } from 'react' + +import { BaseModal, Button, InputTextarea } from '~/libs/ui' + +import styles from './styles.module.scss' +import { applyCopilotOpportunity } from '../../../services/copilot-opportunities' + +interface ApplyOpportunityModalProps { + onClose: () => void + copilotOpportunityId: number + projectName: string + onApplied: () => void +} + +const ApplyOpportunityModal: FC = props => { + const [notes, setNotes] = useState('') + const [success, setSuccess] = useState(false); + + const onApply = useCallback(async () => { + await applyCopilotOpportunity(props.copilotOpportunityId, { + notes, + }) + + props.onApplied() + setSuccess(true) + }, [props.copilotOpportunityId, notes]) + + return ( + +