import { Button } from "@/components/ui/button"; import { CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, } from "@/components/ui/empty"; import { DashboardCard } from "@/components/dashboard-card"; import { CircleCheckIcon, ArrowRightIcon } from "@/components/ui/phosphor-icons"; interface PriorityBreakdownProps { byLabel: Record | null; } const LABELS: { key: string; label: string; dotClass: string }[] = [ { key: "SANGAT TINGGI", label: "Sangat Tinggi", dotClass: "bg-rose-500" }, { key: "TINGGI", label: "Tinggi", dotClass: "bg-orange-500" }, { key: "SEDANG", label: "Sedang", dotClass: "bg-amber-500" }, { key: "RENDAH", label: "Rendah", dotClass: "bg-sky-500" }, { key: "TIDAK PRIORITAS", label: "Tidak Prioritas", dotClass: "bg-emerald-500" }, ]; export function PriorityBreakdown({ byLabel }: PriorityBreakdownProps) { const total = LABELS.reduce((sum, l) => sum + (byLabel?.[l.key] ?? 0), 0); return ( Prioritas Bantuan Distribusi skor fuzzy seluruh KK terdata. {total === 0 ? ( Belum ada skor fuzzy. Tambahkan data warga atau jalankan perhitungan ulang skor di halaman kemiskinan. ) : (
    {LABELS.map((l) => { const count = byLabel?.[l.key] ?? 0; const pct = total > 0 ? (count / total) * 100 : 0; return (
  • {count} KK
  • ); })}
)}
); }