diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte index 590fa4f..1da3837 100644 --- a/web/src/routes/+layout.svelte +++ b/web/src/routes/+layout.svelte @@ -4,6 +4,7 @@ import { onMount, onDestroy } from 'svelte'; import { goto } from '$app/navigation'; import { startSync, stopSync } from '$lib/stores/sync'; + import { todayKey, currentWeekKey } from '$lib/utils'; let { children } = $props(); @@ -16,18 +17,26 @@ onDestroy(stopSync); - const navItems = [ - { href: '/today', label: 'Today' }, - { href: '/week', label: 'Week' }, - { href: '/history', label: 'History' }, - { href: '/settings', label: 'Settings' } - ]; + function todayHref(): string { + return `/week?week=${currentWeekKey()}&day=${todayKey()}`; + } + + // "Today" tab is active when on /week with ?day === todayKey(). + const todayActive = $derived( + page.url.pathname === '/week' && + page.url.searchParams.get('day') === todayKey() + ); + + const weekActive = $derived( + page.url.pathname === '/week' && !todayActive + );
diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 9899104..c083b53 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -1,5 +1,6 @@ diff --git a/web/src/routes/today/+page.svelte b/web/src/routes/today/+page.svelte deleted file mode 100644 index 80e77e0..0000000 --- a/web/src/routes/today/+page.svelte +++ /dev/null @@ -1,19 +0,0 @@ - - -
-

Today — {today}

- -
- -