@@ -420,153 +420,164 @@ export default function RoleFitForm() {
420420 ) ;
421421
422422 return (
423- < Card className = "w-full max-w-6xl mx-auto" >
424- < CardHeader >
425- < CardTitle > Upload JD and CV</ CardTitle >
426- </ CardHeader >
427- < CardContent >
428- < Form { ...form } >
429- < form onSubmit = { form . handleSubmit ( onSubmit ) } className = "space-y-6" >
430- < div className = "grid grid-cols-1 md:grid-cols-2 gap-8 items-stretch" >
431- { /* Left: JD */ }
432- < FormField
433- control = { form . control }
434- name = "jobDescription"
435- render = { ( { field } ) => (
436- < FormItem className = "h-full flex flex-col" >
437- < FormLabel > Job Description (Text or URL)</ FormLabel >
438- < FormControl >
439- < Textarea
440- placeholder = "Paste the JD or a JD URL…"
441- className = "h-full min-h-[300px]"
442- { ...field }
443- />
444- </ FormControl >
445- < FormMessage />
446- </ FormItem >
447- ) }
448- />
449-
450- { /* Right: CV Upload */ }
451- < FormField
452- control = { form . control }
453- name = "cv"
454- render = { ( { field } ) => (
455- < FormItem className = "h-full flex flex-col" >
456- < FormLabel > CV (PDF only)</ FormLabel >
457- < FormControl >
458- < DragAndDropUpload onFileSelect = { field . onChange } />
459- </ FormControl >
460- < FormMessage />
461- </ FormItem >
462- ) }
463- />
464- </ div >
465-
466- { /* Progress & Stepper */ }
467- { step >= 1 && (
468- < div className = "mt-8 space-y-6" >
469- { /* Step circles */ }
470- < div className = "flex justify-between" >
471- { progressSteps . map ( ( s , i ) => {
472- const isCompleted = i < currentStepIdx ;
473- const isActive = i === currentStepIdx && ! error ;
474- const isFailed = ! ! error && i === currentStepIdx ;
475-
476- return (
477- < div key = { s } className = "flex flex-col items-center flex-1" >
478- < div
479- className = { `w-8 h-8 rounded-full flex items-center justify-center mb-2
480- ${ isFailed
481- ? "bg-red-600 text-white"
423+ < div className = "w-full max-w-6xl mx-auto" >
424+ < Card >
425+ < CardHeader >
426+ < CardTitle > Upload JD and CV</ CardTitle >
427+ </ CardHeader >
428+ < CardContent >
429+ < Form { ...form } >
430+ < form onSubmit = { form . handleSubmit ( onSubmit ) } className = "space-y-6" >
431+ < div className = "grid grid-cols-1 md:grid-cols-2 gap-8 items-stretch" >
432+ { /* Left: JD */ }
433+ < FormField
434+ control = { form . control }
435+ name = "jobDescription"
436+ render = { ( { field } ) => (
437+ < FormItem className = "h-full flex flex-col" >
438+ < FormLabel > Job Description (Text or URL)</ FormLabel >
439+ < FormControl >
440+ < Textarea
441+ placeholder = "Paste the JD or a JD URL…"
442+ className = "h-full min-h-[300px]"
443+ { ...field }
444+ />
445+ </ FormControl >
446+ < FormMessage />
447+ </ FormItem >
448+ ) }
449+ />
450+
451+ { /* Right: CV Upload */ }
452+ < FormField
453+ control = { form . control }
454+ name = "cv"
455+ render = { ( { field } ) => (
456+ < FormItem className = "h-full flex flex-col" >
457+ < FormLabel > CV (PDF only)</ FormLabel >
458+ < FormControl >
459+ < DragAndDropUpload onFileSelect = { field . onChange } />
460+ </ FormControl >
461+ < FormMessage />
462+ </ FormItem >
463+ ) }
464+ />
465+ </ div >
466+
467+ { /* Progress & Stepper */ }
468+ { step >= 1 && (
469+ < div className = "mt-8 space-y-6" >
470+ { /* Step circles */ }
471+ < div className = "flex justify-between" >
472+ { progressSteps . map ( ( s , i ) => {
473+ const isCompleted = i < currentStepIdx ;
474+ const isActive = i === currentStepIdx && ! error ;
475+ const isFailed = ! ! error && i === currentStepIdx ;
476+
477+ return (
478+ < div key = { s } className = "flex flex-col items-center flex-1" >
479+ < div
480+ className = { `w-8 h-8 rounded-full flex items-center justify-center mb-2
481+ ${ isFailed
482+ ? "bg-red-600 text-white"
483+ : isCompleted
484+ ? "bg-green-600 text-white"
485+ : isActive
486+ ? "border-2 border-primary-600 text-primary-600"
487+ : "border-2 border-gray-300 text-gray-400"
488+ } `}
489+ >
490+ { isFailed && < X className = "h-4 w-4" /> }
491+ { isCompleted && < Check className = "h-4 w-4" /> }
492+ { isActive && < Loader2 className = "h-4 w-4 animate-spin" /> }
493+ </ div >
494+ < span
495+ className = { `text-xs text-center ${ isFailed
496+ ? "text-red-600 font-medium"
482497 : isCompleted
483- ? "bg -green-600 text-white "
498+ ? "text -green-700 font-medium "
484499 : isActive
485- ? "border-2 border-primary-600 text-primary-600"
486- : "border-2 border-gray-300 text-gray-400"
487- } `}
488- >
489- { isFailed && < X className = "h-4 w-4" /> }
490- { isCompleted && < Check className = "h-4 w-4" /> }
491- { isActive && < Loader2 className = "h-4 w-4 animate-spin" /> }
500+ ? "text-primary-700 font-medium"
501+ : "text-gray-500"
502+ } `}
503+ >
504+ { s }
505+ </ span >
492506 </ div >
493- < span
494- className = { `text-xs text-center ${ isFailed
495- ? "text-red-600 font-medium"
496- : isCompleted
497- ? "text-green-700 font-medium"
498- : isActive
499- ? "text-primary-700 font-medium"
500- : "text-gray-500"
501- } `}
502- >
503- { s }
504- </ span >
505- </ div >
506- ) ;
507- } ) }
507+ ) ;
508+ } ) }
509+ </ div >
510+
511+ { /* Progress bar always visible */ }
512+ < Progress value = { percentDone } className = "w-full" />
513+
514+ { /* Helper text */ }
515+ < p className = "text-sm text-gray-600 text-center" >
516+ { error
517+ ? "Something went wrong. Please try again."
518+ : "Analyzing your CV & JD — this usually takes ~30 seconds. You'll be redirected when the report is ready." }
519+ </ p >
508520 </ div >
521+ ) }
509522
510- { /* Progress bar always visible */ }
511- < Progress value = { percentDone } className = "w-full" />
512-
513- { /* Helper text */ }
514- < p className = "text-sm text-gray-600 text-center" >
515- { error
516- ? "Something went wrong. Please try again."
517- : "Analyzing your CV & JD — this usually takes ~30 seconds. You’ll be redirected when the report is ready." }
518- </ p >
519- </ div >
520- ) }
521-
522- { /* Error */ }
523- { error && < p className = "text-sm text-red-600" > { error } </ p > }
524-
525- { /* Credit display (RIGHT ABOVE THE BUTTON) */ }
526- < div className = "text-center" >
527- { isAuthed === false ? (
528- < p className = "text-sm text-gray-700 mb-2" >
529- Credits Remaining: < span className = "font-semibold" > { credits . remaining } </ span > / 2
530- < span className = "text-xs text-gray-500 block mt-1" >
531- < a href = { getLoginUrl ( DIRECTUS_URL , EXTERNAL . auth_idp_key , "/dashboard" ) } className = "text-blue-600 hover:text-blue-800 underline" > Login</ a > and get 5 free credits
532- </ span >
533- </ p >
534- ) : isAuthed === true ? (
535- < p className = "text-sm text-gray-700 mb-2" >
523+ { /* Error */ }
524+ { error && < p className = "text-sm text-red-600" > { error } </ p > }
525+
526+ { /* Credit display (RIGHT ABOVE THE BUTTON) */ }
527+ < div className = "text-center" >
528+ { isAuthed === false ? (
529+ < p className = "text-sm text-gray-700 mb-2" >
530+ Credits Remaining: < span className = "font-semibold" > { credits . remaining } </ span > / 2
531+ < span className = "text-xs text-gray-500 block mt-1" >
532+ < a href = { getLoginUrl ( DIRECTUS_URL , EXTERNAL . auth_idp_key , "/dashboard" ) } className = "text-primary-600 hover:text-primary-800 underline" > Login</ a > and get 5 free credits
533+ </ span >
534+ </ p >
535+ ) : isAuthed === true ? (
536+ < p className = "text-sm text-gray-700 mb-2" >
536537 Credits Remaining: < span className = "font-semibold" > { credits . remaining } </ span > /{ " " }
537- < span className = "font-semibold" > { totalQuota } </ span >
538- </ p >
538+ < span className = "font-semibold" > { totalQuota } </ span >
539+ </ p >
540+ ) : (
541+ < p className = "text-xs text-gray-500 mb-2" >
542+ Loading credits...
543+ </ p >
544+ ) }
545+ </ div >
546+
547+ { /* Conditionally show button or top-up link based on credits */ }
548+ { credits . remaining === 0 ? (
549+ < Button
550+ asChild
551+ variant = "default"
552+ className = "w-full"
553+ >
554+ < a href = "/dashboard/role-fit-index/top-up" >
555+ Top Up Credits to Continue
556+ </ a >
557+ </ Button >
539558 ) : (
540- < p className = "text-xs text-gray-500 mb-2" >
541- Loading credits...
542- </ p >
559+ < Button
560+ type = "submit"
561+ variant = "default"
562+ className = "w-full"
563+ disabled = { submitting || step !== 0 }
564+ >
565+ { buttonText }
566+ </ Button >
543567 ) }
544- </ div >
545-
546- { /* Conditionally show button or top-up link based on credits */ }
547- { credits . remaining === 0 ? (
548- < Button
549- asChild
550- variant = "default"
551- className = "w-full"
552- >
553- < a href = "/dashboard/role-fit-index/top-up" >
554- Top Up Credits to Continue
555- </ a >
556- </ Button >
557- ) : (
558- < Button
559- type = "submit"
560- variant = "default"
561- className = "w-full"
562- disabled = { submitting || step !== 0 }
563- >
564- { buttonText }
565- </ Button >
566- ) }
567- </ form >
568- </ Form >
569- </ CardContent >
570- </ Card >
568+ </ form >
569+ </ Form >
570+ </ CardContent >
571+ </ Card >
572+
573+ { /* View All Reports link for logged-in users */ }
574+ { isAuthed === true && (
575+ < div className = "text-center mt-4" >
576+ < a href = "/dashboard/role-fit-index" className = "text-sm text-primary-600 hover:text-primary-800 underline" >
577+ View All Reports
578+ </ a >
579+ </ div >
580+ ) }
581+ </ div >
571582 ) ;
572583}
0 commit comments