@@ -5,6 +5,7 @@ import { useReactToPrint } from "react-to-print";
55import { Card , CardHeader , CardTitle , CardContent } from "@/components/ui/card" ;
66import { Progress } from "@/components/ui/progress" ;
77import { Button } from "@/components/ui/button" ;
8+ import { Badge } from "@/components/ui/badge" ;
89import { Check , X , Download , Shield , LogIn } from "lucide-react" ;
910import { EXTERNAL } from '@/constant' ;
1011import { getUserProfile , getLoginUrl , type UserProfile } from '@/lib/utils' ;
@@ -59,10 +60,23 @@ function fmtMinutes(iso: string) {
5960
6061function prettifyStatus ( raw : string ) {
6162 if ( ! raw ) return "—" ;
62- if ( raw === "failed_parse_jd" ) return "Job description parsing failed" ;
63+ if ( raw === "failed_parsing_jd" ) return "Job description parsing failed" ;
64+ if ( raw === "failed_generating_report" ) return "Report generation failed" ;
6365 return raw . replace ( / _ / g, " " ) ;
6466}
6567
68+ function getStatusIcon ( status : string ) {
69+ if ( status === "success" ) return < Check className = "h-4 w-4 text-green-600" /> ;
70+ if ( status ?. startsWith ( "failed" ) ) return < X className = "h-4 w-4 text-red-600" /> ;
71+ return null ;
72+ }
73+
74+ function getStatusColor ( status : string ) {
75+ if ( status === "success" ) return "bg-green-100 text-green-800" ;
76+ if ( status ?. startsWith ( "failed" ) ) return "bg-red-100 text-red-800" ;
77+ return "bg-yellow-100 text-yellow-800" ;
78+ }
79+
6680function getExpressionLevel ( score : number ) : { level : string ; color : string ; imagePath : string } {
6781 if ( score >= 80 ) {
6882 return { level : "High" , color : "text-green-600" , imagePath : "/expression_high.png" } ;
@@ -97,9 +111,8 @@ export default function ReportCard() {
97111
98112 const roleName = report ?. submission ?. job_description ?. role_name ?? "—" ;
99113 const companyName = report ?. submission ?. job_description ?. company_name ?? "—" ;
100- const backfillStatus = prettifyStatus (
101- report ?. submission ?. job_description ?. backfill_status ?? ""
102- ) ;
114+ const rawBackfillStatus = report ?. submission ?. job_description ?. backfill_status ?? "" ;
115+ const backfillStatus = prettifyStatus ( rawBackfillStatus ) ;
103116
104117 // Create a nicely formatted filename for the PDF download
105118 const createFileName = ( ) => {
@@ -410,12 +423,13 @@ export default function ReportCard() {
410423 ) }
411424 </ p >
412425 </ div >
413- { backfillStatus &&
414- backfillStatus . toLowerCase ( ) !== "success" && (
426+ { rawBackfillStatus &&
427+ rawBackfillStatus . toLowerCase ( ) !== "success" && (
415428 < p >
416- < span className = "inline-flex items-center gap-1 rounded-full bg-red-100 text-red-700 px-2 py-1 text-xs font-medium" >
429+ < Badge className = { `flex items-center gap-1 ${ getStatusColor ( rawBackfillStatus ) } ` } >
430+ { getStatusIcon ( rawBackfillStatus ) }
417431 { backfillStatus }
418- </ span >
432+ </ Badge >
419433 </ p >
420434 ) }
421435 < p className = "text-sm text-gray-500" >
0 commit comments