Files
legal-ai/web-ui/src/components/precedents/corroboration-badge.tsx
Chaim f46bf47d5b feat(web-ui): expose citation-corroboration badge on halachot (X11)
- db.list_halachot: aggregate corroboration_count (distinct positive sources)
  + corroboration_negative from halacha_citation_corroboration (LEFT JOIN)
- web-ui: CorroborationBadge — 'מתוקף · N ציטוטים' at ≥2 (gold), soft single
  citation, danger badge on negative treatment; native title tooltips
- shown in ExtractedHalachotSection (per-precedent) + halacha review panel

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 05:04:31 +00:00

52 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Scale, AlertTriangle } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import type { Halacha } from "@/lib/api/precedent-library";
/* X11 — citation corroboration signal for a halacha.
*
* Shows how many distinct later courts/committees adopted this halacha
* (positive treatment). ≥2 distinct positive sources = "מתוקף" (the
* auto-approve threshold, INV-COR4); a single citation is shown more
* softly. A negative treatment (distinguished/criticized/overruled) is
* surfaced as a warning — those never auto-approve and an overruled one
* is sent back to the chair gate (INV-COR2). Renders nothing when there
* is no citation signal at all. */
export function CorroborationBadge({ halacha }: { halacha: Halacha }) {
const count = halacha.corroboration_count ?? 0;
const negative = halacha.corroboration_negative ?? false;
if (negative) {
return (
<Badge
variant="outline"
className="text-[0.65rem] bg-danger-bg text-danger border-danger/40"
title="ערכאה/ועדה מאוחרת אבחנה, מתחה ביקורת או ביטלה הלכה זו — אינה מאושרת אוטומטית בתיקוף-ציטוטים (X11)"
>
<AlertTriangle className="w-3 h-3 me-1" /> טיפול שלילי בציטוט
</Badge>
);
}
if (count <= 0) return null;
const corroborated = count >= 2;
return (
<Badge
variant="outline"
className={
corroborated
? "text-[0.65rem] bg-gold-wash text-gold-deep border-gold/40 tabular-nums"
: "text-[0.65rem] bg-rule-soft text-ink-muted tabular-nums"
}
title={
corroborated
? `מתוקף ע"י ${count} ערכאות/ועדות מאוחרות שאימצו הלכה זו (טיפול שיפוטי מצטבר, X11)`
: "ציטוט מאמת בודד — מתחת לסף התיקוף (נדרשים ≥2 מקורות בלתי-תלויים, X11)"
}
>
<Scale className="w-3 h-3 me-1" />
{corroborated ? `מתוקף · ${count} ציטוטים` : "ציטוט מאמת · 1"}
</Badge>
);
}