import type { PluginDetailTabProps } from "@paperclipai/plugin-sdk/ui"; import { usePluginData } from "@paperclipai/plugin-sdk/ui/hooks"; import type { LegalArgument, LegalArgumentsResponse, LegalCaseDetails, MissingPrecedentRow, PrecedentRow, } from "./types.js"; const containerStyle: React.CSSProperties = { padding: 16, fontFamily: "system-ui, -apple-system, 'Segoe UI', 'Noto Sans Hebrew', sans-serif", color: "inherit", }; const sectionStyle: React.CSSProperties = { marginBottom: 24, }; const headingStyle: React.CSSProperties = { fontSize: 16, fontWeight: 600, margin: "0 0 8px 0", borderBottom: "1px solid rgba(127,127,127,0.25)", paddingBottom: 4, }; const metaListStyle: React.CSSProperties = { display: "grid", gridTemplateColumns: "max-content 1fr", columnGap: 12, rowGap: 4, fontSize: 14, margin: 0, }; const detailsBlockStyle: React.CSSProperties = { margin: "6px 0", padding: "6px 10px", background: "rgba(127,127,127,0.08)", borderRadius: 6, }; const ulStyle: React.CSSProperties = { listStyle: "none", paddingInlineStart: 0, margin: 0, }; const liStyle: React.CSSProperties = { padding: "4px 0", fontSize: 14, borderBottom: "1px dotted rgba(127,127,127,0.2)", }; const mutedStyle: React.CSSProperties = { color: "rgba(127,127,127,0.8)", fontSize: 13, }; function PartySection({ party, args, }: { party: string; args: LegalArgument[]; }) { if (!args || args.length === 0) return null; return (
{party} {args.map((a, idx) => { const key = a.id ?? `${party}-${a.claim_index ?? idx}`; const title = a.argument_title || (a.argument_body || "").slice(0, 80) || "(ללא כותרת)"; const body = a.argument_body || ""; return (
{title} {body && (

{body}

)}
); })}
); } export function LegalCaseTab({ context }: PluginDetailTabProps) { const issueId = context.entityId; const summary = usePluginData("legal-case-summary", { issueId, }); const args = usePluginData( "legal-case-arguments", { issueId }, ); const precedents = usePluginData( "legal-case-precedents", { issueId }, ); const missing = usePluginData( "legal-case-missing-precedents", { issueId }, ); if (summary.loading) { return (

טוען נתוני תיק…

); } if (summary.error) { return (

שגיאה בטעינת התיק: {summary.error.message}

); } if (!summary.data) { return (

אין תיק ערר מקושר ל-issue זה. ניתן ליצור תיק חדש דרך CEO או דרך כלי המערכת.

); } const caseDetails = summary.data; const byParty = args.data?.by_party ?? {}; const argsTotal = args.data?.total ?? 0; const precedentsList = precedents.data ?? []; const missingList = missing.data ?? []; return (

תיק {caseDetails.case_number}

כותרת: {caseDetails.title} סטטוס: {caseDetails.status} {caseDetails.practice_area && ( <> תחום: {caseDetails.practice_area} )} {caseDetails.appeal_subtype && ( <> סוג ערר: {caseDetails.appeal_subtype} )} {caseDetails.expected_outcome && ( <> תוצאה צפויה: {caseDetails.expected_outcome} )}

טיעונים משפטיים ({argsTotal})

{args.loading &&

טוען טיעונים…

} {args.error && (

שגיאה: {args.error.message}

)} {!args.loading && argsTotal === 0 && (

לא חולצו עדיין טיעונים מהמסמכים.

)} {Object.entries(byParty).map(([party, list]) => ( ))}

פסיקה מצורפת ({precedentsList.length})

{precedents.loading &&

טוען פסיקה…

} {precedents.error && (

שגיאה: {precedents.error.message}

)} {!precedents.loading && precedentsList.length === 0 && (

לא צורפה עדיין פסיקה לתיק.

)} {precedentsList.length > 0 && (
    {precedentsList.map((p) => (
  • {p.citation} {p.practice_area && ( — {p.practice_area} )}
  • ))}
)}

פסיקה חסרה ({missingList.length})

{missing.loading &&

טוען רשימת חסרים…

} {missing.error && (

שגיאה: {missing.error.message}

)} {!missing.loading && missingList.length === 0 && (

אין פסיקה חסרה פתוחה בתיק זה.

)} {missingList.length > 0 && (
    {missingList.map((m) => (
  • {m.citation} — {m.status} {m.legal_topic && ( ({m.legal_topic}) )}
  • ))}
)}
); }