From e2b3df0508751d982c76752435390e958eb73b13 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Sat, 20 Jan 2024 11:27:31 -0600 Subject: Migrate repos Signed-off-by: Matt Strapp --- clients/www/src/lib/components/ReloadPrompt.svelte | 32 +++++++++++++++++++++ clients/www/src/lib/offlineToast.ts | 33 ---------------------- clients/www/src/routes/+layout.svelte | 9 ++++-- clients/www/src/routes/+page.svelte | 4 ++- 4 files changed, 42 insertions(+), 36 deletions(-) create mode 100644 clients/www/src/lib/components/ReloadPrompt.svelte delete mode 100644 clients/www/src/lib/offlineToast.ts (limited to 'clients/www/src') diff --git a/clients/www/src/lib/components/ReloadPrompt.svelte b/clients/www/src/lib/components/ReloadPrompt.svelte new file mode 100644 index 0000000..e6effbb --- /dev/null +++ b/clients/www/src/lib/components/ReloadPrompt.svelte @@ -0,0 +1,32 @@ + diff --git a/clients/www/src/lib/offlineToast.ts b/clients/www/src/lib/offlineToast.ts deleted file mode 100644 index 3ae943e..0000000 --- a/clients/www/src/lib/offlineToast.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { getToastStore, type ToastSettings } from '@skeletonlabs/skeleton'; - -const toastStore = getToastStore(); - -const offline: ToastSettings = { - message: 'You are currently offline.', - background: 'variant-filled-error', - autohide: false -}; - -const online: ToastSettings = { - message: 'You are back online.', - background: 'variant-filled-success', - autohide: true, - timeout: 3000 -}; - -/** - * Make a toast for if the PWA is ever brought offline for whatever reason. - */ -export default function offlineToast() { - window.addEventListener('offline', () => { - toastStore.clear(); - toastStore.trigger(offline); - }); - - window.addEventListener('online', () => { - toastStore.clear(); - setTimeout(() => { - toastStore.trigger(online); - }, 300); - }); -} diff --git a/clients/www/src/routes/+layout.svelte b/clients/www/src/routes/+layout.svelte index 15780c3..12996ec 100644 --- a/clients/www/src/routes/+layout.svelte +++ b/clients/www/src/routes/+layout.svelte @@ -1,4 +1,5 @@