Skip to content

Commit

Permalink
Fix PWA toast
Browse files Browse the repository at this point in the history
  • Loading branch information
PurelyAnecdotal authored Feb 19, 2024
1 parent 5a72bb0 commit 4d45ba3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
35 changes: 18 additions & 17 deletions src/lib/ReloadPrompt.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@
</script>

{#if $offlineReady || $needRefresh}
<Toast
color="green"
position="bottom-right"
contentClass="w-full text-sm font-normal flex items-center justify-between"
>
<DownloadOutline slot="icon" class="focus:outline-none" />
<div class="fixed bottom-4 right-4">
<Toast
color="green"
contentClass="w-full text-sm font-normal flex items-center justify-between"
>
<DownloadOutline slot="icon" class="focus:outline-none" />

<span class="text-gray-300">
{#if $offlineReady}
App ready to work offline
{:else if $needRefresh}
Update available
{/if}
</span>
<span class="text-gray-300">
{#if $offlineReady}
App ready to work offline
{:else if $needRefresh}
Update available
{/if}
</span>

{#if $needRefresh}
<Button on:click={reload} size="xs">Reload</Button>
{/if}
</Toast>
{#if $needRefresh}
<Button on:click={reload} size="xs">Reload</Button>
{/if}
</Toast>
</div>
{/if}
8 changes: 4 additions & 4 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import '../app.css';
</script>

{#await import('$lib/ReloadPrompt.svelte') then { default: ReloadPrompt }}
<div class="fixed w-full h-full"><ReloadPrompt /></div>
{/await}

<svelte:head>
{@html pwaInfo?.webManifest.linkTag ?? ''}
</svelte:head>

<slot />

{#await import('$lib/ReloadPrompt.svelte') then { default: ReloadPrompt }}
<ReloadPrompt />
{/await}

0 comments on commit 4d45ba3

Please sign in to comment.