feat(frontend): add root layout with auth guard and bottom navbar

Adds +layout.ts auth guard (redirects to /login when no token).
Adds bottom navbar with inline SVGs for Categories/Tags/Files/Pools/
Settings, active-route highlight (#343249), muted-to-bright color
transition. Adds theme store (dark/light, persisted to localStorage,
applies data-theme attribute). Hides navbar on /login route.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-05 03:21:00 +03:00
parent e21d0ef67b
commit 7770960cbf
9 changed files with 190 additions and 5 deletions
+29
View File
@@ -0,0 +1,29 @@
import { writable } from 'svelte/store';
import { browser } from '$app/environment';
type Theme = 'dark' | 'light';
function loadTheme(): Theme {
if (!browser) return 'dark';
return (localStorage.getItem('theme') as Theme) ?? 'dark';
}
function applyTheme(theme: Theme) {
if (!browser) return;
if (theme === 'light') {
document.documentElement.setAttribute('data-theme', 'light');
} else {
document.documentElement.removeAttribute('data-theme');
}
}
export const themeStore = writable<Theme>(loadTheme());
themeStore.subscribe((theme) => {
applyTheme(theme);
if (browser) localStorage.setItem('theme', theme);
});
export function toggleTheme() {
themeStore.update((t) => (t === 'dark' ? 'light' : 'dark'));
}