feat(ui): תור-אישור הלכות מאוחד — 2 תצוגות לפי פעולה (#133)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 6s

מבטל את ה-toggle "תור נקי / דורש תיקון-חילוץ" שבו "תור נקי" ריק
לגמרי (כל ההלכות-הנקיות נפתרו), והעבודה האמיתית חבויה מאחורי
הכפתור השני שגם מערבב התלבטות-פאנל עם פגמי-חילוץ. אושר ב-Claude
Design (כרטיס 19-halacha-queue-unified).

במקום זה — תור אחד, fetch אחד, פיצול client-side לפי **סוג-הפעולה**:
- "להכרעתך" = הלכות שהפאנל דן בהן (יש panel_round) או נקיות →
  אשר/דחה, עם טבלת-ההתלבטות; ממוין פיצול-פאנל-תחילה (FU-3).
- "דורש תיקון-חילוץ" = מסומנות-דגל שלא עברו התלבטות → תיקון-חילוץ.

`useHalachotPending` אוחד לקריאה אחת (exclude_low_quality=false +
order_by_priority + cluster + include_equivalents + include_panel_round);
נוסף `isExtractionFixItem(h)` (= !panel_round && יש דגל). PendingPanel
מפצל ב-useMemo, segmented-control עם מוני שני הדליים. אפס שינוי-backend
(הפרמטרים כבר קיימים מ-#220/#222).

display-only, שער-אישור יחיד (INV-IA/G10). ולידציה: tsc + eslint נקי.
חלק מ-#133.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 07:29:39 +00:00
parent a0b3c17381
commit f0a8af30dc
2 changed files with 68 additions and 60 deletions

View File

@@ -603,37 +603,33 @@ export function useRequestHalachotExtraction() {
/** #84.1/#84.2/#84.3 — the chair review queue.
*
* Default ("clean") view: quality-gated (flagged items hidden), priority-ordered
* (most-uncertain/negatively-treated first), and near-duplicate-clustered into
* one card. Pass `needsFix: true` for the 'needs extraction fix' bucket — every
* pending item carrying a quality flag (filtered client-side). */
export function useHalachotPending(
opts: { limit?: number; needsFix?: boolean } = {},
) {
const { limit = 200, needsFix = false } = opts;
const qs = needsFix
? `review_status=pending_review&exclude_low_quality=false`
+ `&include_panel_round=true&limit=${limit}`
: `review_status=pending_review&exclude_low_quality=true`
+ `&order_by_priority=true&cluster=true&include_equivalents=true`
+ `&include_panel_round=true&limit=${limit}`;
* ONE fetch of the whole pending set (#133 unified queue): all pending halachot,
* priority-ordered (panel-split first → most-uncertain → oldest, #84.3/FU-3),
* near-duplicate-clustered, with the latest panel deliberation attached. The
* review panel splits this client-side by ACTION — "להכרעה" (has a panel round)
* vs "תיקון-חילוץ" (flagged, never adjudicated) — instead of the old empty
* clean/needsfix toggle. */
export function useHalachotPending(opts: { limit?: number } = {}) {
const { limit = 200 } = opts;
const qs = `review_status=pending_review&exclude_low_quality=false`
+ `&order_by_priority=true&cluster=true&include_equivalents=true`
+ `&include_panel_round=true&limit=${limit}`;
return useQuery({
queryKey: [...libraryKeys.halachotPending(), needsFix ? "needsfix" : "clean"],
queryFn: async ({ signal }) => {
const res = await apiRequest<{ items: Halacha[]; count: number }>(
`/api/halachot?${qs}`,
{ signal },
);
if (!needsFix) return res;
// needs-fix bucket = pending items that carry a quality flag
const items = res.items.filter((h) => (h.quality_flags?.length ?? 0) > 0);
return { items, count: items.length };
},
queryKey: libraryKeys.halachotPending(),
queryFn: ({ signal }) =>
apiRequest<{ items: Halacha[]; count: number }>(`/api/halachot?${qs}`, { signal }),
staleTime: 5_000,
refetchOnMount: "always",
});
}
/** A pending item belongs in the "needs extraction fix" segment when it carries a
* quality flag AND the panel never deliberated it (no round). Everything else —
* deliberated items and clean items — is a chair-judgment item. (#133 unified queue) */
export function isExtractionFixItem(h: Halacha): boolean {
return !h.panel_round && (h.quality_flags?.length ?? 0) > 0;
}
export function useHalachotByStatus(status: string, limit = 300) {
return useQuery({
queryKey: libraryKeys.halachot({ review_status: status, limit: String(limit) }),