"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. */ // Severity expressed as a colored dot next to the title (matches the approved // IA-redesign mockup): high=danger, medium=warn, low=info, ok=success. const SEVERITY_DOT: Record = { high: "bg-danger", medium: "bg-warn", low: "bg-info", ok: "bg-success", }; 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 ( {/* top row — severity dot · title+age · big count number (mockup 01) */}

{cat.label}

{cleared ? ( תור נקי ) : cat.oldest_at ? ( <>הוותיק ביותר — {formatDate(cat.oldest_at)} ) : ( cat.description )}
{cat.count}
{/* description kept (subtle) when the age line took the title slot */} {!cleared && cat.oldest_at ? (

{cat.description}

) : null} {cat.extra ? (

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

) : null} {!cleared && cat.sample && cat.sample.length > 0 ? (
    {cat.sample.map((s, i) => { const row = (
    {s.text || "—"} {s.source ? ( {s.source} ) : null}
    ); return (
  • {s.href ? ( {row} ) : ( row )}
  • ); })}
) : cleared ? (

אין פריטים הממתינים להתייחסות. כל התיקים עברו בדיקת-איכות.

) : null} {/* foot — gold CTA when actionable, quiet outline when cleared */}
{cat.href ? ( cleared ? ( ) : ( ) ) : ( סקירה ידנית (ראה דוח 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) => ( ))}
)}
); }