import type { PluginWidgetProps } from "@paperclipai/plugin-sdk/ui"; import { usePluginData } from "@paperclipai/plugin-sdk/ui/hooks"; import type { DashboardStats } from "./types.js"; const widgetStyle: React.CSSProperties = { padding: 12, fontFamily: "system-ui, -apple-system, 'Segoe UI', 'Noto Sans Hebrew', sans-serif", color: "inherit", }; const headingStyle: React.CSSProperties = { margin: "0 0 8px 0", fontSize: 15, fontWeight: 600, }; const totalStyle: React.CSSProperties = { fontSize: 22, fontWeight: 700, margin: "4px 0", }; const ulStyle: React.CSSProperties = { listStyle: "none", paddingInlineStart: 0, margin: 0, display: "grid", gridTemplateColumns: "1fr max-content", rowGap: 2, fontSize: 13, }; const labelStyle: React.CSSProperties = { color: "rgba(127,127,127,0.85)", }; const STATUS_LABELS: Record = { new: "תיק חדש", uploading: "העלאת מסמכים", processing: "עיבוד מסמכים", documents_ready: "מסמכים מוכנים", outcome_set: "תוצאה הוזנה", brainstorming: "סיעור מוחות", direction_approved: "כיוון אושר", drafting: "כתיבה", qa_review: "בדיקת איכות", drafted: "טיוטה מוכנה", exported: "DOCX נוצר", reviewed: "נבדק", final: "סופי", }; export function LegalCasesWidget(_props: PluginWidgetProps) { const { data, loading, error } = usePluginData( "legal-dashboard-stats", {}, ); if (loading) { return (

תיקי ערר

טוען…

); } if (error) { return (

תיקי ערר

{error.message}

); } if (!data) { return (

תיקי ערר

אין נתונים זמינים.

); } const entries = Object.entries(data.byStatus).sort(([, a], [, b]) => b - a); return (

תיקי ערר

{data.totalCases}
סה"כ תיקים פעילים

{entries.length > 0 ? (
    {entries.map(([status, count]) => (
  • {STATUS_LABELS[status] ?? status} {count}
  • ))}
) : (

אין תיקים פעילים.

)}

פעילות שבועית: {data.weekActivity}

); }