"use client"; import { Sparkles } from "lucide-react"; import type { DashboardData } from "@/lib/types"; interface Props { data: DashboardData; } function generateSummary(data: DashboardData): string { const parts: string[] = []; const { deadline_summary: ds, case_summary: cs, upcoming_deadlines: ud } = data; // Deadline urgency if (ds.overdue_count > 0) { parts.push( `${ds.overdue_count} Frist${ds.overdue_count > 1 ? "en" : ""} ${ds.overdue_count > 1 ? "sind" : "ist"} überfällig und ${ds.overdue_count > 1 ? "erfordern" : "erfordert"} sofortige Aufmerksamkeit.`, ); } if (ds.due_this_week > 0) { parts.push( `${ds.due_this_week} Frist${ds.due_this_week > 1 ? "en laufen" : " läuft"} diese Woche ab.`, ); } // Highlight most critical upcoming deadline if (ud.length > 0) { const next = ud[0]; parts.push( `Die nächste Frist ist "${next.title}" in Akte ${next.case_number}.`, ); } // Case activity if (cs.new_this_month > 0) { parts.push( `${cs.new_this_month} neue Akte${cs.new_this_month > 1 ? "n" : ""} diesen Monat bei ${cs.active_count} aktiven Verfahren.`, ); } else { parts.push(`${cs.active_count} aktive Verfahren.`); } // All good if (ds.overdue_count === 0 && ds.due_this_week === 0) { parts.unshift("Alle Fristen sind im Zeitplan."); } return parts.join(" "); } export function AISummaryCard({ data }: Props) { const summary = generateSummary(data); return (
{summary}