From 437b0b8cf12773ceac42e7ba63121a5122506655 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 18 May 2026 20:20:01 +0100 Subject: [PATCH] Add live indicator to board page --- src/lib/components/ui/LiveIndicator.svelte | 49 ++++++++++++++++++++++ src/routes/board/+page.svelte | 8 +++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/lib/components/ui/LiveIndicator.svelte diff --git a/src/lib/components/ui/LiveIndicator.svelte b/src/lib/components/ui/LiveIndicator.svelte new file mode 100644 index 0000000..6900b66 --- /dev/null +++ b/src/lib/components/ui/LiveIndicator.svelte @@ -0,0 +1,49 @@ +
+
+ Live +
+ + \ No newline at end of file diff --git a/src/routes/board/+page.svelte b/src/routes/board/+page.svelte index 3ae0990..a3fd113 100644 --- a/src/routes/board/+page.svelte +++ b/src/routes/board/+page.svelte @@ -6,8 +6,10 @@ import { formatUkDateTime, formatUkTime } from '$lib/utils/time'; import StaffServicesTable from '$lib/components/ui/station-board/StaffServicesTable.svelte'; + import LiveIndicator from '$lib/components/ui/LiveIndicator.svelte'; let { data } = $props(); let now = $state(new Date()); + let live = $state(false); // Handle auto-refreshing & Wake-lock $effect(() => { @@ -46,8 +48,10 @@ await invalidateAll(); } catch (error) { console.error("Background data fetch failed: ", error) + live = false; } }, 61000); + live = true; console.log("Polling started") }; @@ -107,12 +111,14 @@ $effect(() => { // Load Data Invalidation Handling // Refresh countdown logic -
Updated: {formatUkDateTime(data.boardData.producedAt, true)} {formatUkTime(now, true)}
+ {#if live} + + {/if} {#if data.boardData.data.m?.length} {/if}