feat(halacha-queue): show panel deliberation + add search on rejected/approved tabs
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 4s
Lint — undefined names / undefined-names (pull_request) Successful in 11s

The 3-judge panel deliberation was only surfaced in the pending queue; the
'rejected'/'approved' tabs hid WHY an item was auto-rejected/approved even
though the data is captured (reviewer='panel:... maj-not-entailed'). And those
tabs had no way to locate a specific item.

- useHalachotByStatus now requests include_panel_round=true and accepts a
  server-side search term (same /api/halachot params the pending queue uses).
- HalachaRestoreCard renders the existing PanelDeliberation component when a
  round exists — same card the chair already sees in pending.
- RestorePanel gains the same locate-bar (debounced, server-side search) +
  a match-count indicator; the bar stays visible on empty/loading so a search
  is always clearable.

Reuses already-approved UI (deliberation = Design card 18, locate-bar = card
19); composition onto a sibling surface, approved directly by chaim. tsc +
eslint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-19 10:24:54 +00:00
parent f9ef664ac9
commit 8c455d6ef6
2 changed files with 86 additions and 32 deletions

View File

@@ -668,14 +668,21 @@ export function isExtractionFixItem(h: Halacha): boolean {
);
}
export function useHalachotByStatus(status: string, limit = 300) {
export function useHalachotByStatus(
status: string,
opts: { limit?: number; search?: string } = {},
) {
const { limit = 300, search = "" } = opts;
const term = search.trim();
// include_panel_round surfaces the 3-judge deliberation on these tabs too
// (same card as the pending queue), so the chair sees WHY an item was
// auto-rejected/approved; search locates an item server-side beyond the window.
const qs = `review_status=${encodeURIComponent(status)}&include_panel_round=true&limit=${limit}`
+ (term ? `&search=${encodeURIComponent(term)}` : "");
return useQuery({
queryKey: libraryKeys.halachot({ review_status: status, limit: String(limit) }),
queryKey: libraryKeys.halachot({ review_status: status, limit: String(limit), search: term }),
queryFn: ({ signal }) =>
apiRequest<{ items: Halacha[]; count: number }>(
`/api/halachot?review_status=${encodeURIComponent(status)}&limit=${limit}`,
{ signal },
),
apiRequest<{ items: Halacha[]; count: number }>(`/api/halachot?${qs}`, { signal }),
staleTime: 10_000,
refetchOnMount: "always",
});