From 1aadd3b4559e0e5269b2de4cd7a6aea865898ade Mon Sep 17 00:00:00 2001 From: Chaim Date: Mon, 1 Jun 2026 05:50:12 +0000 Subject: [PATCH] feat(web-ui): sort corroborated halachot first in extracted list (X11) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Halachot carrying a corroboration badge (positive citation count or a negative treatment) float to the top of 'הלכות שחולצו', ordered by corroboration strength; the rest keep document order by halacha_index. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../components/precedents/extracted-halachot.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/web-ui/src/components/precedents/extracted-halachot.tsx b/web-ui/src/components/precedents/extracted-halachot.tsx index cdcafeb..28281f1 100644 --- a/web-ui/src/components/precedents/extracted-halachot.tsx +++ b/web-ui/src/components/precedents/extracted-halachot.tsx @@ -78,9 +78,21 @@ export function ExtractedHalachotSection({ halachot }: { halachot: Halacha[] }) if (filter === "pending") return h.review_status === "pending_review"; return h.review_status === "rejected"; }; + /* Surface citation-corroborated halachot first: any with a badge + * (positive count or a negative treatment) float to the top, ordered + * by corroboration strength; the rest keep document order by index. */ + const hasTag = (h: Halacha) => + (h.corroboration_count ?? 0) > 0 || (h.corroboration_negative ?? false); return halachot .filter(matches) - .sort((a, b) => a.halacha_index - b.halacha_index); + .sort((a, b) => { + const tagDelta = Number(hasTag(b)) - Number(hasTag(a)); + if (tagDelta !== 0) return tagDelta; + const countDelta = + (b.corroboration_count ?? 0) - (a.corroboration_count ?? 0); + if (countDelta !== 0) return countDelta; + return a.halacha_index - b.halacha_index; + }); }, [halachot, filter]); if (!halachot.length) { -- 2.49.1