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 ---------------------- 2 files changed, 32 insertions(+), 33 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/lib') 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); - }); -} -- cgit v1.2.3