@@ -13,9 +13,9 @@ import {
1313 PageDivider ,
1414 profileContext ,
1515 ProfileContextData ,
16+ SaveForLaterIcon ,
1617 useCheckIsMobile
1718} from '../../../../../lib'
18- import { SaveForLaterIcon } from '../../../../../lib/svgs'
1919import {
2020 Challenge ,
2121 ChallengeMetadata ,
@@ -31,7 +31,7 @@ import {
3131import { WorkServicePrice } from '../../../work-service-price'
3232import { WorkTypeBanner } from '../../../work-type-banner'
3333import { dashboardRoute , selfServiceStartRoute } from '../../../work.routes'
34- import IntakeFormsBreadcrumb from '../intake-forms-breadcrumb/IntakeFormsBreadcrumb '
34+ import { IntakeFormsBreadcrumb } from '../intake-forms-breadcrumb'
3535
3636import { BugHuntFormConfig } from './bug-hunt.form.config'
3737import styles from './BugHunt.module.scss'
@@ -45,9 +45,9 @@ const BugHuntIntakeForm: React.FC = () => {
4545 const isMobile : boolean = useCheckIsMobile ( )
4646 const { isLoggedIn } : ProfileContextData = useContext < ProfileContextData > ( profileContext )
4747
48- const [ action , setAction ] : [ FormAction , Dispatch < SetStateAction < FormAction > > ] = useState ( )
49- const [ loading , setLoading ] : [ boolean , Dispatch < SetStateAction < boolean > > ] = useState ( false )
50- const [ saveSuccess , setSaveSuccess ] : [ boolean , Dispatch < SetStateAction < boolean > > ] = useState ( false )
48+ const [ action , setAction ] : [ FormAction , Dispatch < SetStateAction < FormAction > > ] = useState < FormAction > ( )
49+ const [ loading , setLoading ] : [ boolean , Dispatch < SetStateAction < boolean > > ] = useState < boolean > ( false )
50+ const [ saveSuccess , setSaveSuccess ] : [ boolean , Dispatch < SetStateAction < boolean > > ] = useState < boolean > ( false )
5151
5252 BugHuntFormConfig . buttons . primaryGroup [ 0 ] . onClick = ( ) => { setAction ( 'save' ) }
5353 BugHuntFormConfig . buttons . primaryGroup [ 0 ] . hidden = ! isLoggedIn
@@ -123,9 +123,9 @@ const BugHuntIntakeForm: React.FC = () => {
123123 ] )
124124
125125 useEffect ( ( ) => {
126- if ( ! loading && saveSuccess ) {
127- handleSaveSuccess ( )
128- }
126+ if ( ! loading && saveSuccess ) {
127+ handleSaveSuccess ( )
128+ }
129129 } , [ loading , saveSuccess ] )
130130
131131 const requestGenerator : ( inputs : ReadonlyArray < FormInputModel > ) => void = ( inputs ) => {
@@ -178,16 +178,16 @@ const BugHuntIntakeForm: React.FC = () => {
178178 }
179179
180180 const handleSaveSuccess : ( ) => void = ( ) => {
181- if ( action === 'save' ) {
182- navigate ( `${ dashboardRoute } /draft` )
183- } else if ( action === 'submit' ) {
184- const nextUrl : string = `${ WorkIntakeFormRoutes [ WorkType . bugHunt ] [ 'review' ] } /${ workId || challenge ?. id } `
185- navigate ( nextUrl )
186- }
181+ if ( action === 'save' ) {
182+ navigate ( `${ dashboardRoute } /draft` )
183+ } else if ( action === 'submit' ) {
184+ const nextUrl : string = `${ WorkIntakeFormRoutes [ WorkType . bugHunt ] [ 'review' ] } /${ workId || challenge ?. id } `
185+ navigate ( nextUrl )
186+ }
187187 }
188188
189189 const onSaveSuccess : ( ) => void = ( ) => {
190- setSaveSuccess ( true )
190+ setSaveSuccess ( true )
191191 }
192192
193193 const goToLoginStep : ( formData : any ) => void = ( formData : any ) => {
@@ -224,42 +224,42 @@ const BugHuntIntakeForm: React.FC = () => {
224224 workType = { workBugHuntConfig . type }
225225 />
226226 < div className = { styles [ 'bug-hunt-wrapper' ] } >
227- < WorkTypeBanner
228- title = { workBugHuntConfig . title }
229- subTitle = { workBugHuntConfig . subtitle }
230- workType = { workBugHuntConfig . type }
231- />
232- < WorkServicePrice
233- duration = { workBugHuntConfig . duration ?. [ selectedPackage ] || 0 }
234- hideTitle
235- icon = { < IconOutline . BadgeCheckIcon width = { 48 } height = { 48 } /> }
236- iconClass = { styles [ 'bug-hunt-icon' ] }
237- price = { workBugHuntConfig . priceConfig . getPrice ( workBugHuntConfig . priceConfig , selectedPackage ) }
238- serviceType = { workBugHuntConfig . type }
239- showIcon
240- />
241- < div >
242- < DeliverablesInfoCard isMobile = { isMobile } />
243- < InfoCard
244- color = 'success'
245- defaultOpen = { ! isMobile }
246- isCollapsible
247- title = { `About ${ workBugHuntConfig . type } ` }
248- >
249- { workBugHuntConfig . about }
250- </ InfoCard >
251- < PageDivider />
252- < Form
253- onChange = { onChange }
254- formDef = { formDef }
255- formValues = { formValues }
256- onSuccess = { onSaveSuccess }
257- requestGenerator = { requestGenerator }
258- save = { onSave }
259- action = { action }
260- shouldDisableButton = { shouldDisableButton }
261- />
262- </ div >
227+ < WorkTypeBanner
228+ title = { workBugHuntConfig . title }
229+ subTitle = { workBugHuntConfig . subtitle }
230+ workType = { workBugHuntConfig . type }
231+ />
232+ < WorkServicePrice
233+ duration = { workBugHuntConfig . duration ?. [ selectedPackage ] || 0 }
234+ hideTitle
235+ icon = { < IconOutline . BadgeCheckIcon width = { 48 } height = { 48 } /> }
236+ iconClass = { styles [ 'bug-hunt-icon' ] }
237+ price = { workBugHuntConfig . priceConfig . getPrice ( workBugHuntConfig . priceConfig , selectedPackage ) }
238+ serviceType = { workBugHuntConfig . type }
239+ showIcon
240+ />
241+ < div >
242+ < DeliverablesInfoCard isMobile = { isMobile } />
243+ < InfoCard
244+ color = 'success'
245+ defaultOpen = { ! isMobile }
246+ isCollapsible
247+ title = { `About ${ workBugHuntConfig . type } ` }
248+ >
249+ { workBugHuntConfig . about }
250+ </ InfoCard >
251+ < PageDivider />
252+ < Form
253+ onChange = { onChange }
254+ formDef = { formDef }
255+ formValues = { formValues }
256+ onSuccess = { onSaveSuccess }
257+ requestGenerator = { requestGenerator }
258+ save = { onSave }
259+ action = { action }
260+ shouldDisableButton = { shouldDisableButton }
261+ />
262+ </ div >
263263 </ div >
264264 </ >
265265 )
0 commit comments