some more improvements

This commit is contained in:
JCEEE
2026-09-15 15:14:18 +01:00
parent 833a34049e
commit 78f456bf77
8 changed files with 94 additions and 41 deletions
+18
View File
@@ -2,8 +2,26 @@
import './layout.css';
import favicon from '$lib/assets/favicon.svg';
import NoticeDialog from '$lib/components/NoticeDialog.svelte';
import { famStore } from '$lib/stores/fam.svelte';
let { children } = $props();
// Last-resort net: PocketBase SDK fetch failures (the minified `send()`
// frame in prod stacks) otherwise surface as unhandled rejections with no
// UI signal. Network-shaped ones flip the TopNav status dot; the fam
// layout's resync clears it once the pipe is healthy again.
if (typeof window !== 'undefined') {
window.addEventListener('unhandledrejection', (e: PromiseRejectionEvent) => {
const msg = String((e.reason as any)?.message || e.reason || '');
if (
/TypeError|Failed to fetch|Load failed|NetworkError|network|offline|ERR_QUIC|ERR_NETWORK|ERR_INTERNET/i.test(
msg
)
) {
famStore.connectionDown = true;
}
});
}
</script>
<svelte:head><link rel="icon" href={favicon} /></svelte:head>
+19 -17
View File
@@ -212,6 +212,7 @@
if (!summary?.summaries?.length) return;
if (choresCanvas && summary.daysInWeek?.length) {
// daysInWeek runs payday+1..payday (weeks close on payday).
const days = summary.daysInWeek;
const labels = days.map((d: string) =>
new Date(d + 'T12:00:00').toLocaleDateString('en-GB', { weekday: 'short' })
@@ -333,19 +334,8 @@
subtitle={`${page.data.fam?.name || famSlug}${summary?.weekStart ? ` · Week of ${formatDDMMYY(summary.weekStart)}` : ''}`}
hero
>
<!-- All-time family totals, large in the header -->
<div class="vh-stats grow text-right">
<span class="vh-stat">
<span class="vh-num pts">{allTimePts.toLocaleString()}</span>
<span class="vh-lbl">points all time</span>
</span>
<span class="vh-stat">
<span class="vh-num cash">£{allTimeCash.toFixed(2)}</span>
<span class="vh-lbl">cash earned all time</span>
</span>
</div>
<!-- Shared-computer toggle, bottom-left of the hero -->
<div class="vh-foot">
<!-- Shared-computer toggle (left) + all-time totals (right), one line -->
<div class="vh-toprow">
<button
class="shared-hero-toggle"
class:on={sharedDevice.on}
@@ -356,6 +346,16 @@
{@html monitorIcon}
<span>Shared computer {sharedDevice.on ? '· On' : '· Off'}</span>
</button>
<div class="vh-stats text-right">
<span class="vh-stat">
<span class="vh-num pts">{allTimePts.toLocaleString()}</span>
<span class="vh-lbl">points all time</span>
</span>
<span class="vh-stat">
<span class="vh-num cash">£{allTimeCash.toFixed(2)}</span>
<span class="vh-lbl">cash earned all time</span>
</span>
</div>
</div>
</ViewHeader>
@@ -522,12 +522,14 @@
letter-spacing: 0.08em;
opacity: 0.85;
}
/* Shared-computer toggle row, bottom-left of the hero */
.vh-foot {
/* Shared-computer toggle (left) + all-time totals (right), one line */
.vh-toprow {
flex: 1 1 100%;
display: flex;
justify-content: flex-start;
margin-top: 0.75rem;
justify-content: space-between;
align-items: flex-end;
gap: 1rem;
margin-top: 0.5rem;
}
.shared-hero-toggle {
display: inline-flex;
@@ -294,7 +294,8 @@
Math.max(
0,
Math.round(
(new Date(addDays(weekStart, 7) + 'T00:00:00').getTime() -
// Payday closes the week on weekStart+6 (weeks run payday+1..payday).
(new Date(addDays(weekStart, 6) + 'T00:00:00').getTime() -
new Date(todayIso + 'T00:00:00').getTime()) /
86400000
)