diff --git a/web/src/lib/components/WeekView.svelte b/web/src/lib/components/WeekView.svelte
new file mode 100644
index 0000000..b8710be
--- /dev/null
+++ b/web/src/lib/components/WeekView.svelte
@@ -0,0 +1,270 @@
+
+
+
+
+
+ {#if error}
{error}
{/if}
+
+
+
+ {#each dayKeys as dk, i (dk)}
+
+ ondaychange(dk)}
+ />
+
+ {/each}
+
+
+
+
+ Worked
+ {formatDurationShort(totalWorkedMs)}
+
+
+ Expected
+ {formatDurationShort(expectedMs)}
+
+
= expectedMs}>
+ Delta
+ {formatDelta(totalWorkedMs - expectedMs)}
+
+
+
+ {#if closedWeek}
+
+
Week closed — overtime: {formatDelta(closedWeek.delta_ms)}
+
+
+ {:else if canCloseWeek}
+
+ {/if}
+
+
+
{selectedDay}
+ {
+ if (cd !== undefined) {
+ if (cd === null) {
+ const { [selectedDay]: _, ...rest } = closedDaysMap;
+ closedDaysMap = rest;
+ } else {
+ closedDaysMap = { ...closedDaysMap, [selectedDay]: cd };
+ }
+ } else {
+ load();
+ }
+ }}
+ />
+
+
+
+
diff --git a/web/src/lib/utils.ts b/web/src/lib/utils.ts
index 423d087..49fe3db 100644
--- a/web/src/lib/utils.ts
+++ b/web/src/lib/utils.ts
@@ -180,3 +180,10 @@ export function dayCapabilities(
canReopenDay: false
};
}
+
+/** Default day to select for a given week: today if in the week, else Monday. */
+export function defaultDayForWeek(weekKey: string): string {
+ const keys = weekDayKeys(weekKey);
+ const t = todayKey();
+ return keys.includes(t) ? t : keys[0];
+}
diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte
index 170bdce..3940bf3 100644
--- a/web/src/routes/+layout.svelte
+++ b/web/src/routes/+layout.svelte
@@ -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 @@