"use client";
import { Card, CardContent } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
import { SubjectDonut } from "@/components/training/subject-donut";
import { useStyleReport } from "@/lib/api/training";
function KPICard({
label,
value,
caption,
}: {
label: string;
value: string;
caption?: string;
}) {
return (
{label}
{value}
{caption && (
{caption}
)}
);
}
export function StyleReportPanel() {
const { data, isPending, error } = useStyleReport();
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 */}
★ {c.headline}
{/* KPIs */}
{/* Subjects + anatomy */}
פיזור נושאים
{dateRange && (
טווח תאריכים: {dateRange}
)}
אנטומיה של החלטה ממוצעת
{data.anatomy.headline && (
{data.anatomy.headline}
)}
{data.anatomy.sections.length === 0 ? (
אין נתונים על מבנה
) : (
)}
{/* Signature phrases */}
ביטויי חתימה
{data.signature_phrases.headline && (
{data.signature_phrases.headline}
)}
{data.signature_phrases.items.length === 0 ? (
אין ביטויים שחולצו עדיין
) : (
{data.signature_phrases.items.slice(0, 12).map((p, i) => (
-
#{i + 1}
{p.text}
{p.context && (
{p.context}
)}
×{p.frequency}
))}
)}
);
}