From 59ff4e31cfda7a58bf214319e9e7e92fb08d99c1 Mon Sep 17 00:00:00 2001 From: Chaim Date: Sat, 6 Jun 2026 12:27:48 +0000 Subject: [PATCH] =?UTF-8?q?feat(halacha):=20=D7=9B=D7=A4=D7=AA=D7=95=D7=A8?= =?UTF-8?q?=D7=99=20=D7=90=D7=99=D7=A9=D7=95=D7=A8/=D7=93=D7=97=D7=99?= =?UTF-8?q?=D7=99=D7=94/=D7=A9=D7=97=D7=96=D7=95=D7=A8=20inline=20=D7=91?= =?UTF-8?q?=D7=A8=D7=9B=D7=99=D7=91=20"=D7=94=D7=9C=D7=9B=D7=95=D7=AA=20?= =?UTF-8?q?=D7=A9=D7=97=D7=95=D7=9C=D7=A6=D7=95"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ExtractedHalachotSection היה read-only — הוסף כפתורי פעולה לכל הלכה לפי review_status: נדחתה → אשר/שחזר לתור · מאושרת → בטל אישור/דחה · ממתינה → אשר/דחה. משתמש ב-useUpdateHalacha שמרענן את detail query. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../precedents/extracted-halachot.tsx | 84 +++++++++++++++++-- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/web-ui/src/components/precedents/extracted-halachot.tsx b/web-ui/src/components/precedents/extracted-halachot.tsx index 28281f1..018ec3a 100644 --- a/web-ui/src/components/precedents/extracted-halachot.tsx +++ b/web-ui/src/components/precedents/extracted-halachot.tsx @@ -1,9 +1,12 @@ "use client"; import { useMemo, useState } from "react"; +import { Check, X, RotateCcw } from "lucide-react"; +import { toast } from "sonner"; import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; import { CorroborationBadge } from "@/components/precedents/corroboration-badge"; -import type { Halacha } from "@/lib/api/precedent-library"; +import { useUpdateHalacha, type Halacha } from "@/lib/api/precedent-library"; const RULE_TYPE_LABELS: Record = { binding: "הלכה מחייבת", @@ -47,13 +50,26 @@ export function ReviewStatusPill({ status }: { status: Halacha["review_status"] ); } -/* Read-only roll-up of every halacha extracted from a precedent — - * approved + pending + rejected. The "ממתין לאישור" tab only surfaces - * pending items globally; this section is the per-case view. To act on - * an item (approve / edit / reject), go to the review tab — keeping the - * surfaces separated avoids duplicate review UX in two places. */ +/* Roll-up of every halacha extracted from a precedent — approved + + * pending + rejected. The "ממתין לאישור" tab surfaces pending items + * globally; this section is the per-case view, with inline status + * actions so the chair can flip a single ruling (e.g. approve one that + * was rejected) without leaving the precedent. */ export function ExtractedHalachotSection({ halachot }: { halachot: Halacha[] }) { const [filter, setFilter] = useState("all"); + const update = useUpdateHalacha(); + + const setStatus = async ( + h: Halacha, + status: "approved" | "rejected" | "pending_review", + ) => { + try { + await update.mutateAsync({ id: h.id, patch: { review_status: status } }); + toast.success("עודכן"); + } catch (e) { + toast.error(e instanceof Error ? e.message : "שגיאה"); + } + }; const counts = useMemo(() => { const c = { all: halachot.length, approved: 0, pending: 0, rejected: 0 }; @@ -204,6 +220,62 @@ export function ExtractedHalachotSection({ halachot }: { halachot: Halacha[] }) ))} ) : null} + + {/* Inline status actions — contextual per current review_status */} +
+ {h.review_status === "rejected" && ( + <> + + + + )} + {(h.review_status === "approved" || h.review_status === "published") && ( + <> + + + + )} + {h.review_status === "pending_review" && ( + <> + + + + )} +
))}