refactor: default to today-view
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user