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:
@@ -0,0 +1,16 @@
|
||||
import { get } from 'svelte/store';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { browser } from '$app/environment';
|
||||
import { authStore } from '$lib/stores/auth';
|
||||
|
||||
export const ssr = false;
|
||||
|
||||
export const load = ({ url }: { url: URL }) => {
|
||||
if (!browser) return;
|
||||
if (url.pathname === '/login') return;
|
||||
|
||||
const { accessToken } = get(authStore);
|
||||
if (!accessToken) {
|
||||
redirect(307, '/login');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user