aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/routes
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2023-09-13 16:04:12 -0500
committerMatt Strapp <matt@mattstrapp.net>2023-09-14 13:26:23 -0500
commit319a10b9a106e768ea2d3fb6d7134817911208ce (patch)
treed4d71c83665ff583071f387309980b6cdb893d88 /app/src/routes
parentInitial commit (diff)
downloadtrinkets-319a10b9a106e768ea2d3fb6d7134817911208ce.tar
trinkets-319a10b9a106e768ea2d3fb6d7134817911208ce.tar.gz
trinkets-319a10b9a106e768ea2d3fb6d7134817911208ce.tar.bz2
trinkets-319a10b9a106e768ea2d3fb6d7134817911208ce.tar.lz
trinkets-319a10b9a106e768ea2d3fb6d7134817911208ce.tar.xz
trinkets-319a10b9a106e768ea2d3fb6d7134817911208ce.tar.zst
trinkets-319a10b9a106e768ea2d3fb6d7134817911208ce.zip
Add basic PWA support
TODO: draw the rest of the owl
Diffstat (limited to '')
-rw-r--r--app/src/routes/+layout.svelte27
-rw-r--r--app/src/routes/+layout.ts2
-rw-r--r--app/src/routes/+page.svelte6
3 files changed, 33 insertions, 2 deletions
diff --git a/app/src/routes/+layout.svelte b/app/src/routes/+layout.svelte
index 3d5c07f..93a41b1 100644
--- a/app/src/routes/+layout.svelte
+++ b/app/src/routes/+layout.svelte
@@ -1,4 +1,8 @@
<script lang="ts">
+ import { registerSW } from 'virtual:pwa-register'
+ import { pwaInfo } from 'virtual:pwa-info';
+ import { onMount } from 'svelte'
+
import '../app.postcss';
import { AppShell, AppBar } from '@skeletonlabs/skeleton';
@@ -6,8 +10,31 @@
import { computePosition, autoUpdate, flip, shift, offset, arrow } from '@floating-ui/dom';
import { storePopup } from '@skeletonlabs/skeleton';
storePopup.set({ computePosition, autoUpdate, flip, shift, offset, arrow });
+
+ onMount(async () => {
+ if (pwaInfo) {
+ registerSW({
+ immediate: true,
+ onRegistered(r) {
+ console.log(`SW Registered: ${r}`)
+ },
+ onRegisterError(error) {
+ console.log('SW registration error', error)
+ },
+ onOfflineReady() {
+ console.log('SW Offline Ready')
+ }
+ })
+ }
+ })
+
+ $: webManifestLink = pwaInfo ? pwaInfo.webManifest.linkTag : ''
</script>
+<svelte:head>
+ {@html webManifestLink}
+</svelte:head>
+
<!-- App Shell -->
<AppShell>
<svelte:fragment slot="header">
diff --git a/app/src/routes/+layout.ts b/app/src/routes/+layout.ts
index c8cacf0..189f71e 100644
--- a/app/src/routes/+layout.ts
+++ b/app/src/routes/+layout.ts
@@ -1 +1 @@
-export const prerender = true; \ No newline at end of file
+export const prerender = true;
diff --git a/app/src/routes/+page.svelte b/app/src/routes/+page.svelte
index 67c0353..7cd11ed 100644
--- a/app/src/routes/+page.svelte
+++ b/app/src/routes/+page.svelte
@@ -1,8 +1,12 @@
+<svelte:head>
+ <title>Coming Soon(TM)</title>
+</svelte:head>
+
<!-- YOU CAN DELETE EVERYTHING IN THIS PAGE -->
<div class="container h-full mx-auto flex justify-center items-center">
<div class="space-y-10 text-center flex flex-col items-center">
- <h2 class="h2">Welcome to Skeleton.</h2>
+ <h2 class="h2">Welcome to a placeholder.</h2>
<!-- Animated Logo -->
<figure>
<section class="img-bg" />