import { AlertTriangle, ChevronDown, Download, Star } from "lucide-react"; import { AnswerMedia, CameraPanel, CvView, IntegrityPanel, SkillsPanel } from "../components/insights"; import { useEffect, useState } from "react"; import { Link, useParams } from "react-router-dom"; import { Badge, Button, ErrorNote, Field, Meter, Panel, ScoreRing, Spinner, Textarea, Waveform, fmtDate, scoreColor, useCatalog } from "../components/ui"; import { api, type Answer, type Session } from "../lib/api"; import { useAuth } from "../lib/auth"; import { trackName, useI18n } from "../lib/i18n"; function QuestionCard({ a, sid, open: initial, lang }: { a: Answer; sid: string; open: boolean; lang: string }) { const { t } = useI18n(); const [open, setOpen] = useState(initial); const fb = a.feedback || ({} as NonNullable); const dir = lang === "ar" ? "rtl" : "ltr"; const p = a.presence; return (
{open && (
{a.has_audio && a.media === "video" && }
{t("your_answer")} {a.has_audio && a.media !== "video" && }

{a.transcript || t("not_answered")}

{fb.summary &&

{fb.summary}

}
{!!fb.strengths?.length && (

{t("went_well")}

    {fb.strengths.map((s, i) =>
  • {s}
  • )}
)} {!!fb.improvements?.length && (

{t("improve")}

    {fb.improvements.map((s, i) =>
  • {s}
  • )}
)}
{fb.improved_answer && (

{t("stronger")}

{fb.improved_answer}

)}
{fb.delivery_tip && {t("delivery_tip")}: {fb.delivery_tip}}
{(fb.rubric || (p && p.samples)) && (
{fb.rubric && (["clarity", "example_quality", "structure", "outcome"] as const).map((k) => fb.rubric![k] != null && {t(`rb_${k}`)}: {fb.rubric![k]}/10)} {!!p?.samples && {t("eye_contact")}: {Math.round((p.eye_contact ?? 0) * 100)}%} {!!p?.samples && p.emotions && (() => { const top = (Object.entries(p.emotions) as [string, number][]).sort((x, y) => y[1] - x[1])[0]; return {t(`emo_${top[0]}` as "emo_happy")} {Math.round(top[1] * 100)}%; })()} {!!p?.events?.length && {p.events.length}}
)}
)}
); } function ReviewPanel({ s }: { s: Session }) { const { t } = useI18n(); const [status, setStatus] = useState("new"); const [rating, setRating] = useState(null); const [notes, setNotes] = useState(""); const [saved, setSaved] = useState(false); useEffect(() => { if (!s.job_id) return; api.get(`/jobs/${s.job_id}/candidates`).then((rows) => { const r = rows.find((x) => x.id === s.id); if (r) { setStatus(r.review_status); setRating(r.rating); setNotes(r.notes || ""); } }); }, [s]); const save = async () => { await api.put(`/reviews/${s.id}`, { status, rating, notes }); setSaved(true); setTimeout(() => setSaved(false), 2000); }; return (

{t("fairness")}

{(["new", "shortlisted", "rejected", "hired"] as const).map((k) => ( ))}
{t("rating")} {[1, 2, 3, 4, 5].map((n) => ( ))}