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:
+4
-4
@@ -145,6 +145,9 @@ async function navigate(path, userOrPushState = true, pushState = true) {
|
|||||||
history.pushState({ path }, '', path);
|
history.pushState({ path }, '', path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const accent = route?.module ? getCSSToken(`--module-${route.module}`) : '';
|
||||||
|
document.documentElement.style.setProperty('--active-module-accent', accent);
|
||||||
|
|
||||||
await renderPage(route, previousPath);
|
await renderPage(route, previousPath);
|
||||||
updateNav(path);
|
updateNav(path);
|
||||||
updateThemeColorForRoute(route);
|
updateThemeColorForRoute(route);
|
||||||
@@ -322,10 +325,7 @@ function updateNav(path) {
|
|||||||
// Bottom-Nav zur aktiven Seite scrollen
|
// Bottom-Nav zur aktiven Seite scrollen
|
||||||
scrollNavToActive();
|
scrollNavToActive();
|
||||||
|
|
||||||
// Modul-Akzentfarbe auf :root setzen — wird von Nav-CSS gelesen
|
// Modul-Akzentfarbe wird in navigate() gesetzt, wo route bereits aufgelöst ist.
|
||||||
const route = ROUTES.find(r => r.path === path);
|
|
||||||
const accent = route?.module ? getCSSToken(`--module-${route.module}`) : '';
|
|
||||||
document.documentElement.style.setProperty('--active-module-accent', accent || '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderError(container, err) {
|
function renderError(container, err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user