refactor: default to today-view

This commit is contained in:
2026-05-08 20:40:20 +00:00
parent d3faf79b57
commit 7e6c47a50e
7 changed files with 313 additions and 303 deletions
+2 -10
View File
@@ -5,7 +5,6 @@
import { onMount, onDestroy } from 'svelte';
import { goto } from '$app/navigation';
import { startSync, stopSync, triggerSync, syncState } from '$lib/stores/sync';
import { todayKey, currentWeekKey } from '$lib/utils';
let { children } = $props();
@@ -26,14 +25,7 @@
onDestroy(stopSync);
function todayHref(): string {
return `/week?week=${currentWeekKey()}&day=${todayKey()}`;
}
const todayActive = $derived(
page.url.pathname === '/week' &&
page.url.searchParams.get('day') === todayKey()
);
const todayActive = $derived(page.url.pathname === '/today');
const weekActive = $derived(
page.url.pathname === '/week' && !todayActive
@@ -63,7 +55,7 @@
<nav>
<div class="nav-links">
<a href={todayHref()} class:active={todayActive}>Today</a>
<a href="/today" class:active={todayActive}>Today</a>
<a href="/week" class:active={weekActive}>Week</a>
<a href="/history" class:active={page.url.pathname === '/history'}>History</a>
<a href="/settings" class:active={page.url.pathname === '/settings'}>Settings</a>