"use client"; import Link from "next/link"; import { AppShell } from "@/components/app-shell"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { usePendingApprovals, type ApprovalCategory, type ApprovalSeverity, } from "@/lib/api/chair"; /** * מרכז אישורים — דפנה (INV-G10). * * עמוד אחד שמרכז את כל השערים האנושיים הממתינים להכרעת היו"ר: אישור הלכות, * פסיקה חסרה, הערות שטרם יושמו, ותיקים שנכשלו ב-QA. המטרה: * שאף פריט הדורש את אישורך לא יישכח. הנתונים נשלפים חי מ-/api/chair/pending. */ const SEVERITY_BADGE: Record = { high: "bg-gold text-navy border-transparent", medium: "bg-gold-wash text-gold-deep border-gold/40", low: "bg-rule-soft text-ink-muted border-rule", ok: "bg-emerald-50 text-emerald-800 border-emerald-300/60", }; function formatDate(iso?: string | null): string { if (!iso) return ""; try { return new Date(iso).toLocaleDateString("he-IL", { day: "numeric", month: "long", year: "numeric", }); } catch { return ""; } } function ApprovalCard({ cat }: { cat: ApprovalCategory }) { const cleared = cat.count === 0; return (

{cat.label}

{cat.count}

{cat.description}

{cat.oldest_at && cat.count > 0 ? (

הישן ביותר ממתין מ־{formatDate(cat.oldest_at)}

) : null} {cat.extra ? (

סך {cat.extra.total} שאילתות · {cat.extra.reviewed} אושרו על־ידך

) : null} {cleared ? (

אין פריטים ממתינים ✓

) : cat.sample && cat.sample.length > 0 ? (
    {cat.sample.map((s, i) => { const body = ( <> {s.text || "—"} {s.source ? ( · {s.source} ) : null} ); return (
  • {s.href ? ( {body} ) : ( body )}
  • ); })}
) : null}
{cat.href ? ( ) : ( סקירה ידנית (ראה דוח FU-5) )}
); } export default function ApprovalsPage() { const { data, isPending, error } = usePendingApprovals(); return (
שערים אנושיים · יו״ר הוועדה

מרכז אישורים

כל מה שממתין להכרעתך במקום אחד — כדי שאף פריט לא יישכח. מתעדכן חי.

{typeof data?.total_pending === "number" ? (
{data.total_pending}
פריטים ממתינים
) : null}
{error ? ( שגיאה בטעינת מרכז האישורים. נסה לרענן. ) : isPending ? (
{[0, 1, 2, 3, 4].map((i) => ( ))}
) : (
{(data?.categories ?? []).map((cat) => ( ))}
)}
); }