feat(ui): interactive decision-block viewer + inline editor on case page #57

Merged
chaim merged 1 commits from feat/decision-blocks-viewer into main 2026-06-06 09:37:14 +00:00
Owner

סיכום

מוסיף טאב "ההחלטה" בדף התיק — תצוגה אינטראקטיבית של 12 הבלוקים עם עריכה inline שנשמרת ל-DB.

הבעיה שנפתרה: תוכן הבלוקים נשמר ב-DB (ע"י סוכנים) אך לא ניתן היה לצפות בו בלי להוריד DOCX. עכשיו הוא נגיש ישירות בדף התיק.

שינויים

Backend (web/app.py):

  • GET /api/cases/{n}/decision-blocks — מחזיר 12 בלוקים (כולל ריקים), ממוזגים מ-BLOCK_CONFIG + decision_blocks DB. כולל source_of_truth ו-active_draft_path.
  • PUT /api/cases/{n}/decision-blocks/{block_id} — שמירת עריכה inline דרך block_writer.save_block_content. מתריע (לא חוסם) כשקיים DOCX פעיל.

Frontend:

  • src/lib/api/decision-blocks.ts — hooks מוקלדים (useDecisionBlocks, useSaveBlock)
  • src/components/cases/decision-blocks-panel.tsx — accordion של 12 בלוקים; תצוגה עם Markdown, עריכה עם שמירה on-blur (דפוס ChairEditor)
  • BLOCK_LABELS ב-feedback.ts הורחב מ-7 → 12 בלוקים
  • cases/[caseNumber]/page.tsx — טאב "ההחלטה" חדש

בדיקה

  • npm run lint — ללא שגיאות בקבצים החדשים
  • npm run build — עובר בהצלחה
  • לאחר deploy: curl https://legal-ai.../api/cases/8137-24/decision-blocks צריך להחזיר את תוכן בלוק י'
## סיכום מוסיף טאב **"ההחלטה"** בדף התיק — תצוגה אינטראקטיבית של 12 הבלוקים עם עריכה inline שנשמרת ל-DB. **הבעיה שנפתרה:** תוכן הבלוקים נשמר ב-DB (ע"י סוכנים) אך לא ניתן היה לצפות בו בלי להוריד DOCX. עכשיו הוא נגיש ישירות בדף התיק. ## שינויים **Backend (`web/app.py`):** - `GET /api/cases/{n}/decision-blocks` — מחזיר 12 בלוקים (כולל ריקים), ממוזגים מ-`BLOCK_CONFIG` + `decision_blocks` DB. כולל `source_of_truth` ו-`active_draft_path`. - `PUT /api/cases/{n}/decision-blocks/{block_id}` — שמירת עריכה inline דרך `block_writer.save_block_content`. מתריע (לא חוסם) כשקיים DOCX פעיל. **Frontend:** - `src/lib/api/decision-blocks.ts` — hooks מוקלדים (`useDecisionBlocks`, `useSaveBlock`) - `src/components/cases/decision-blocks-panel.tsx` — accordion של 12 בלוקים; תצוגה עם `Markdown`, עריכה עם שמירה on-blur (דפוס `ChairEditor`) - `BLOCK_LABELS` ב-`feedback.ts` הורחב מ-7 → 12 בלוקים - `cases/[caseNumber]/page.tsx` — טאב "ההחלטה" חדש ## בדיקה - `npm run lint` — ללא שגיאות בקבצים החדשים - `npm run build` — עובר בהצלחה - לאחר deploy: `curl https://legal-ai.../api/cases/8137-24/decision-blocks` צריך להחזיר את תוכן בלוק י'
chaim added 1 commit 2026-06-06 09:37:10 +00:00
Adds a new "ההחלטה" tab to the case detail page showing all 12 decision
blocks with rendered markdown content and inline editing that saves back
to the DB via two new FastAPI endpoints.

Backend (web/app.py):
- GET  /api/cases/{n}/decision-blocks   — returns all 12 blocks (empty
  ones included) merged from BLOCK_CONFIG + decision_blocks table.
  Exposes source_of_truth ("docx"|"blocks") and active_draft_path.
- PUT  /api/cases/{n}/decision-blocks/{block_id} — inline save via
  block_writer.save_block_content; warns (does not block) when an
  active DOCX draft exists.

Frontend:
- src/lib/api/decision-blocks.ts    — typed hooks (useDecisionBlocks,
  useSaveBlock) following the cases.ts hand-written-module pattern.
- src/components/cases/decision-blocks-panel.tsx — accordion of 12
  blocks; view mode renders Markdown component; edit mode is a textarea
  with on-blur save (derived from ChairEditor pattern, setState-during-
  render for re-sync to avoid effect cascade).
- BLOCK_LABELS in feedback.ts extended from 7 → 12 blocks.
- cases/[caseNumber]/page.tsx — new "ההחלטה" tab wired to the panel.

No DB migration required — decision_blocks + active_draft_path exist.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
chaim merged commit df97e21d22 into main 2026-06-06 09:37:14 +00:00
chaim deleted branch feat/decision-blocks-viewer 2026-06-06 09:37:14 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ezer-mishpati/legal-ai#57