"use client"; import { Card, CardContent } from "@/components/ui/card"; import { Skeleton } from "@/components/ui/skeleton"; import { SubjectDonut } from "@/components/training/subject-donut"; import { useStyleReport, useCuratorStats } from "@/lib/api/training"; // Mockup 12 anatomy palette — info · gold · gold-deep · success, cycling. const ANATOMY_COLORS = ["#4e6a8c", "#a97d3a", "#8b6428", "#4a7c59"]; function KPICard({ label, value, caption, }: { label: string; value: string; caption?: string; }) { return ( {value} {label} {caption && ( {caption} )} ); } export function StyleReportPanel() { const { data, isPending, error } = useStyleReport(); const curator = useCuratorStats(); if (error) { return ( {error.message} ); } if (isPending || !data) { return (
); } const c = data.corpus; const dateRange = c.date_range[0] && c.date_range[1] ? `${c.date_range[0]} – ${c.date_range[1]}` : undefined; const total = c.decision_count; const totalSubjects = c.subject_distribution.reduce((a, b) => a + b.count, 0); return (
{/* Headline banner — gold-wash, ★ aligned to start (mockup 12) */}

{c.headline}

{/* KPIs */}
{/* LRN-4 (INV-IA5): items.length (style_patterns freq>0) and contribution.total_patterns are independent queries — the old "X מתוך Y" framed a false subset. Show the surfaced count alone. */}
{/* Subjects + anatomy */}

פיזור נושאים

{dateRange && (

טווח תאריכים: {dateRange}

)}

אנטומיה של החלטה ממוצעת

{data.anatomy.headline && (

{data.anatomy.headline}

)} {data.anatomy.sections.length === 0 ? (

אין נתונים על מבנה

) : (
    {data.anatomy.sections.map((s, i) => { const pct = Math.round(s.pct * 100); const fill = ANATOMY_COLORS[i % ANATOMY_COLORS.length]; return (
  • {s.label} {pct}% · {s.avg_chars.toLocaleString()} תווים
  • ); })}
)}
{/* Signature phrases + curator stat — two columns (mockup 12) */}

ביטויי חתימה

{data.signature_phrases.headline && (

{data.signature_phrases.headline}

)} {data.signature_phrases.items.length === 0 ? (

אין ביטויים שחולצו עדיין

) : (
    {data.signature_phrases.items.slice(0, 12).map((p, i) => (
  1. {i + 1}

    {p.text}

    {p.context && (

    {p.context}

    )}
    ×{p.frequency}
  2. ))}
)}
{/* Curator — surfaced style findings (INV-LRN1 writer gate) */}

אוצֵר — ממצאי-סגנון

{curator.data ? curator.data.channels.curator.approved : "—"}
ממצאים מאושרים (זורמים לכותב) אושרו ע״י היו״ר · review_status=approved
{curator.data ? Math.max( 0, curator.data.channels.curator.total - curator.data.channels.curator.approved, ) : "—"}
לא-מאושרים
{curator.data ? curator.data.channels.curator.total : "—"}
סך ממצאים

רק ממצא מאושר זורם לכותב (INV-LRN1). ממתינים ונדחים אינם משפיעים על הטיוטות.

); }