-
Notifications
You must be signed in to change notification settings - Fork 13
feat(PM-578): Apply for copilot opportunity #1067
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
Changes from all commits
92d56f7
3692ce4
63d486a
070098b
54fbb38
49286f4
c767c8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface CopilotApplication { | ||
id: number, | ||
notes?: string, | ||
createdAt: Date, | ||
opportunityId: string, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ApplyOpportunityModalProps> = props => { | ||
const [notes, setNotes] = useState('') | ||
const [success, setSuccess] = useState(false) | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const onApply = useCallback(async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding error handling for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hentrymartin please wrap the applyCopilotOpportunity in try/catch block to avoid calling |
||
try { | ||
await applyCopilotOpportunity(props.copilotOpportunityId, { | ||
notes, | ||
}) | ||
|
||
props.onApplied() | ||
setSuccess(true) | ||
} catch (e) { | ||
setSuccess(true) | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
}, [props.copilotOpportunityId, notes]) | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void = useCallback(e => { | ||
setNotes(e.target.value) | ||
}, [setNotes]) | ||
|
||
return ( | ||
<BaseModal | ||
onClose={props.onClose} | ||
open | ||
size='lg' | ||
title={ | ||
success | ||
? `Your Application for ${props.projectName} Has Been Received!` | ||
: `Confirm Your Copilot Application for ${props.projectName}` | ||
} | ||
buttons={ | ||
!success ? ( | ||
<> | ||
<Button primary onClick={onApply} label='Apply' /> | ||
<Button secondary onClick={props.onClose} label='Cancel' /> | ||
</> | ||
) : ( | ||
<Button primary onClick={props.onClose} label='Close' /> | ||
) | ||
} | ||
> | ||
<div className={styles.applyCopilotModal}> | ||
<div className={styles.info}> | ||
{ | ||
success | ||
? `We appreciate the time and effort you've taken to apply | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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.` | ||
: `We're excited to see your interest in joining our team as a copilot | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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.` | ||
} | ||
</div> | ||
{ | ||
!success && ( | ||
<InputTextarea | ||
name='Notes' | ||
onChange={onChange} | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
value={notes} | ||
/> | ||
) | ||
} | ||
</div> | ||
</BaseModal> | ||
) | ||
} | ||
|
||
export default ApplyOpportunityModal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as ApplyOpportunityModal } from './ApplyOpportunityModal' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@import '@libs/ui/styles/includes'; | ||
|
||
.applyCopilotModal { | ||
.info { | ||
margin-bottom: 12px; | ||
} | ||
} | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.