diff --git a/src/apps/copilots/src/models/CopilotApplication.ts b/src/apps/copilots/src/models/CopilotApplication.ts new file mode 100644 index 000000000..d9ab68ed5 --- /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, +} 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..48fd2f364 --- /dev/null +++ b/src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/ApplyOpportunityModal.tsx @@ -0,0 +1,88 @@ +/* eslint-disable react/jsx-no-bind */ +import { FC, useCallback, useState } from 'react' + +import { BaseModal, Button, InputTextarea } from '~/libs/ui' + +import { applyCopilotOpportunity } from '../../../services/copilot-opportunities' + +import styles from './styles.module.scss' + +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 () => { + try { + await applyCopilotOpportunity(props.copilotOpportunityId, { + notes, + }) + + props.onApplied() + setSuccess(true) + } catch (e) { + setSuccess(true) + } + }, [props.copilotOpportunityId, notes]) + + const onChange: (e: React.ChangeEvent) => void = useCallback(e => { + setNotes(e.target.value) + }, [setNotes]) + + return ( + +