From 0568d340a7dbff5921efd5495301f7dc54ca1fc4 Mon Sep 17 00:00:00 2001 From: mAi Date: Wed, 27 May 2026 20:21:39 +0200 Subject: [PATCH] feat(procedures): U1 fold Mode A (Direkt suchen) (m/paliad#151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mounts mountModeA() into #procedures-panel-search when the Direkt-suchen tab activates. The legacy fristenrechner-mode-a code runs unchanged inside a wrapper that reseeds the #fristen-overhaul-root / #fristen-overhaul-mode-host scaffold on every tab activation, so re-clicking the tab always restores a fresh Mode A surface even if the previous interaction committed an event into the result view. `?event=` deep links still resolve: boot detects the param, activates the search tab, and hands directly to mountResultView() — the result lands inside the same root, the user sees the picked event's follow-up rules with the Direkt-suchen tab as the visible context. Search-box-in-filter-strip composition with chip filters (m's Q3 divergence) lands later, after Mode B + Verfahrensablauf are folded — the unified state machine pulls all three behind one search input. --- frontend/src/client/procedures.ts | 82 ++++++++++++++++++++++++------- frontend/src/procedures.tsx | 15 +++++- 2 files changed, 77 insertions(+), 20 deletions(-) diff --git a/frontend/src/client/procedures.ts b/frontend/src/client/procedures.ts index 1595bde..f85f9f0 100644 --- a/frontend/src/client/procedures.ts +++ b/frontend/src/client/procedures.ts @@ -1,23 +1,20 @@ -// /tools/procedures client — U0 skeleton boot -// (m/paliad#151, docs/design-unified-procedural-events-tool-2026-05-27.md). +// /tools/procedures client (m/paliad#151, +// docs/design-unified-procedural-events-tool-2026-05-27.md). // -// U0 owns: -// - Tab switching across the four entry modes (proceeding / search / -// wizard / akte). URL-driven via ?mode=; cold open lands on -// "proceeding" per design §11.5.Q3. -// - Showing exactly one panel at a time. +// Boot logic + tab switching for the unified procedural-events tool. +// Each entry tab mounts its own module; the search box and chip +// filters in the top filter strip are wired in U1+ as each slice adds +// its dimension-aware behaviour. // -// Later slices wire data: -// U1 mounts Mode A into #procedures-panel-search. -// U2 mounts Mode B into #procedures-panel-wizard. -// U3 mounts Verfahrensablauf into #procedures-panel-proceeding + -// #procedures-output-tree. -// The search box in the top filter strip and the chip filters in -// #procedures-filter-chips-* are also wired in U1+ as each slice -// adds its dimension-aware behaviour. +// U0 — Skeleton + tab toggling. +// U1 — Direkt suchen mounts Mode A (this slice). +// U2 — Geführt mounts Mode B wizard. +// U3 — Verfahren wählen mounts Verfahrensablauf tree + 3-way detail filter. import { initI18n } from "./i18n"; import { initSidebar } from "./sidebar"; +import { mountModeA } from "./fristenrechner-mode-a"; +import { mountResultView } from "./fristenrechner-result"; type ProceduresTab = "proceeding" | "search" | "wizard" | "akte"; @@ -40,7 +37,24 @@ function writeTabToUrl(tab: ProceduresTab): void { history.replaceState(null, "", url.pathname + url.search + url.hash); } -function showTab(tab: ProceduresTab): void { +// ensureSearchHost re-seeds the overhaul-root / mode-host scaffold +// inside the Direkt-suchen panel. Idempotent — re-clicking the search +// tab always restores a fresh Mode A surface, even if the user +// previously committed an event into the result view (which had +// replaced the root's innerHTML). +function ensureSearchHost(): void { + const panel = document.getElementById("procedures-panel-search"); + if (!panel) return; + panel.innerHTML = ` +
+
+
+
+
+ `; +} + +function setActiveTabUI(tab: ProceduresTab): void { for (const t of TABS) { const btn = document.getElementById(`procedures-tab-${t}`); const panel = document.getElementById(`procedures-panel-${t}`); @@ -53,20 +67,52 @@ function showTab(tab: ProceduresTab): void { } } +async function activateTab(tab: ProceduresTab): Promise { + setActiveTabUI(tab); + if (tab === "search") { + ensureSearchHost(); + await mountModeA(); + } + // U2 will mount the wizard here; U3 will mount Verfahrensablauf. +} + function wireTabs(): void { for (const t of TABS) { const btn = document.getElementById(`procedures-tab-${t}`); if (!btn) continue; btn.addEventListener("click", () => { - showTab(t); + void activateTab(t); writeTabToUrl(t); }); } } +// boot dispatches on the URL: a deep link with `?event=` jumps straight +// to the linear result view (the Direkt-suchen tab stays as the visible +// context). Otherwise the requested tab — defaulting to "proceeding" — +// activates per readTabFromUrl(). +async function boot(): Promise { + const params = new URLSearchParams(window.location.search); + const eventRef = params.get("event") || ""; + + if (eventRef) { + setActiveTabUI("search"); + ensureSearchHost(); + await mountResultView({ + eventRef, + triggerDate: params.get("trigger_date") || undefined, + party: params.get("party") || undefined, + courtId: params.get("court_id") || undefined, + }); + return; + } + + await activateTab(readTabFromUrl()); +} + document.addEventListener("DOMContentLoaded", () => { initI18n(); initSidebar(); - showTab(readTabFromUrl()); wireTabs(); + void boot(); }); diff --git a/frontend/src/procedures.tsx b/frontend/src/procedures.tsx index 93bd5b8..277aead 100644 --- a/frontend/src/procedures.tsx +++ b/frontend/src/procedures.tsx @@ -148,8 +148,19 @@ export function renderProcedures(): string {