"use client";
import { Skeleton } from "@/components/ui/skeleton";
import { useLibraryStats } from "@/lib/api/precedent-library";
import { practiceAreaLabel } from "./practice-area";
function StatCard({ label, value, accent }: { label: string; value: number | string; accent?: boolean }) {
return (
);
}
export function LibraryStatsPanel() {
const { data, isPending, error } = useLibraryStats();
if (error) {
return (
{error.message}
);
}
if (isPending || !data) {
return (
{[...Array(4)].map((_, i) => )}
);
}
return (
0}
/>
פילוח לפי תחום
{data.by_practice_area.length === 0 ? (
אין נתונים
) : (
{data.by_practice_area.map((row) => (
-
{practiceAreaLabel(row.practice_area || null)}
{row.count}
))}
)}
פילוח לפי רמת תקדים
{data.by_precedent_level.length === 0 ? (
אין נתונים
) : (
{data.by_precedent_level.map((row) => (
-
{row.precedent_level || "—"}
{row.count}
))}
)}
);
}