import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import { CompanyMark, JobFacts } from "../components/jobs"; import { Badge, Spinner, fmtDate, scoreColor } from "../components/ui"; import { api, type Application } from "../lib/api"; import { useI18n } from "../lib/i18n"; export default function Applications() { const { t, lang } = useI18n(); const [rows, setRows] = useState(null); useEffect(() => { api.get("/applications").then(setRows).catch(() => setRows([])); }, []); if (!rows) return ; const status = (a: Application): [string, "neutral" | "good" | "warn" | "bad" | "info"] => { if (a.status === "in_progress") return [t("as_unfinished"), "warn"]; if (a.status === "processing") return [t("as_processing"), "info"]; if (a.status === "failed") return [t("st_failed"), "bad"]; return { new: [t("as_new"), "neutral"], shortlisted: [t("as_shortlisted"), "good"], rejected: [t("as_rejected"), "bad"], hired: [t("as_hired"), "good"] }[a.review_status] as [string, "neutral"]; }; return (

{t("apps_title")}

{t("browse_jobs")}
{rows.length === 0 ? (

{t("apps_empty")}

) : (
    {rows.map((a) => { const [label, tone] = status(a); return (
  • {a.title}

    {a.company} · {fmtDate(a.created_at, lang)}

    {label} {a.status === "in_progress" ? ( {t("finish_interview")} ) : a.status === "completed" ? ( {a.overall_score != null ? Math.round(a.overall_score) : "–"} {t("view_report")} ) : null}
  • ); })}
)}
); }