From 7fef64159b5734b33d2af6abe1ebfe243e3be1ac Mon Sep 17 00:00:00 2001 From: m Date: Fri, 8 May 2026 23:04:29 +0200 Subject: [PATCH] feat(sidebar): add Verfahrensablauf nav entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit t-paliad-168 deliverable 2. New "Verfahrensablauf" entry under Werkzeuge, right after Fristenrechner — opens /tools/fristenrechner?path=a (Pathway A wizard, browse-/learn-mode). Uses a distinct open-book icon to read separate from the closed-book Glossar. Both /tools/fristenrechner sidebar entries share the same pathname, so SSR navItem matching can't pick the right "active" one on its own — fixVerfahrensablaufActive() in sidebar.ts disambiguates based on ?path=a at hydration. i18n key: nav.verfahrensablauf (DE: "Verfahrensablauf", EN: "Procedure Roadmap"). i18n-keys.ts is regenerated by build.ts. --- frontend/src/client/sidebar.ts | 25 +++++++++++++++++++++++++ frontend/src/components/Sidebar.tsx | 5 +++++ frontend/src/i18n-keys.ts | 3 +++ 3 files changed, 33 insertions(+) diff --git a/frontend/src/client/sidebar.ts b/frontend/src/client/sidebar.ts index 1692f27..178f2e2 100644 --- a/frontend/src/client/sidebar.ts +++ b/frontend/src/client/sidebar.ts @@ -75,6 +75,7 @@ export function initSidebar() { initPaliadinLinks(); initUserViewsGroup(); initThemeToggle(); + fixVerfahrensablaufActive(); const sidebar = document.querySelector(".sidebar"); if (!sidebar) return; initSidebarResize(sidebar); @@ -443,6 +444,30 @@ function initUserViewsGroup(): void { }); } +// fixVerfahrensablaufActive disambiguates the two /tools/fristenrechner +// sidebar entries (t-paliad-168). The SSR navItem helper compares +// hrefs against pathname only, which can't tell ?path=a apart from +// the no-query Fristenrechner — both would render as Fristenrechner= +// active. At the client we know the search params; flip the active +// class so the sidebar lights up the entry the user actually opened. +function fixVerfahrensablaufActive(): void { + if (window.location.pathname !== "/tools/fristenrechner") return; + const path = new URLSearchParams(window.location.search).get("path"); + const fristenrechner = document.querySelector( + 'a.sidebar-item[href="/tools/fristenrechner"]', + ); + const verfahrensablauf = document.querySelector( + 'a.sidebar-item[href="/tools/fristenrechner?path=a"]', + ); + if (path === "a") { + fristenrechner?.classList.remove("active"); + verfahrensablauf?.classList.add("active"); + } else { + verfahrensablauf?.classList.remove("active"); + fristenrechner?.classList.add("active"); + } +} + function renderUserViewItem(view: UserViewLite, currentPath: string): HTMLElement { const a = document.createElement("a"); a.href = `/views/${encodeURIComponent(view.slug)}`; diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 63aaca1..4230547 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -7,6 +7,10 @@ const ICON_CLOCK = '