refactor: move --active-module-accent update into navigate() to avoid duplicate ROUTES.find

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ulas
2026-03-31 13:31:57 +02:00
parent 6a018867e0
commit 7f41ee380a
+4 -4
View File
@@ -145,6 +145,9 @@ async function navigate(path, userOrPushState = true, pushState = true) {
history.pushState({ path }, '', path);
}
const accent = route?.module ? getCSSToken(`--module-${route.module}`) : '';
document.documentElement.style.setProperty('--active-module-accent', accent);
await renderPage(route, previousPath);
updateNav(path);
updateThemeColorForRoute(route);
@@ -322,10 +325,7 @@ function updateNav(path) {
// Bottom-Nav zur aktiven Seite scrollen
scrollNavToActive();
// Modul-Akzentfarbe auf :root setzen — wird von Nav-CSS gelesen
const route = ROUTES.find(r => r.path === path);
const accent = route?.module ? getCSSToken(`--module-${route.module}`) : '';
document.documentElement.style.setProperty('--active-module-accent', accent || '');
// Modul-Akzentfarbe wird in navigate() gesetzt, wo route bereits aufgelöst ist.
}
function renderError(container, err) {