aboutsummaryrefslogtreecommitdiffstats
path: root/clients
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--clients/www/LICENSE (renamed from LICENSE)0
-rw-r--r--clients/www/package.json4
-rw-r--r--clients/www/src/lib/components/ReloadPrompt.svelte32
-rw-r--r--clients/www/src/lib/offlineToast.ts33
-rw-r--r--clients/www/src/routes/+layout.svelte9
-rw-r--r--clients/www/src/routes/+page.svelte4
-rw-r--r--clients/www/svelte.config.js2
7 files changed, 45 insertions, 39 deletions
diff --git a/LICENSE b/clients/www/LICENSE
index f328a5d..f328a5d 100644
--- a/LICENSE
+++ b/clients/www/LICENSE
diff --git a/clients/www/package.json b/clients/www/package.json
index ec7075a..7a84ae8 100644
--- a/clients/www/package.json
+++ b/clients/www/package.json
@@ -1,6 +1,6 @@
{
- "name": "website",
- "description": "The actual website",
+ "name": "zorascript-web",
+ "description": "A Svelte interface for ZoraScript",
"version": "0.0.1",
"private": true,
"license": "MIT",
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 @@
+<script lang="ts">
+ import { getToastStore } from '@skeletonlabs/skeleton'
+ import { useRegisterSW } from 'virtual:pwa-register/svelte'
+
+ const toastStore = getToastStore()
+
+ const { updateServiceWorker } = useRegisterSW({
+ onRegisteredSW(r) {
+ console.log('SW Registered: ', r)
+ },
+ onNeedRefresh() {
+ toastStore.trigger({
+ message: 'A new version of the application is available.',
+ autohide: false,
+ action: {
+ label: 'Refresh',
+ response: updateServiceWorker,
+ },
+ })
+ },
+ onOfflineReady() {
+ toastStore.trigger({
+ background: 'variant-filled-success',
+ message: 'Now ready for offline use!',
+ timeout: 5000,
+ })
+ },
+ onRegisterError(err) {
+ console.error('SW Registration Error: ', err)
+ },
+ })
+</script>
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 @@
<script lang="ts">
+ import { base } from '$app/paths';
import '../app.postcss';
import { AppShell, AppBar, LightSwitch, initializeStores } from '@skeletonlabs/skeleton';
@@ -22,12 +23,16 @@
<svelte:fragment slot="lead">
<LightSwitch />
</svelte:fragment>
- <a href="#">Zelda: Oracle Password Generator</a>
+ <a href="{base}/">Zelda: Oracle Password Generator</a>
<svelte:fragment slot="trail">
- <a href="#">TODO: SOURCE CODE</a>
+ <a href="https://github.com/RosstheRoss/zorascript">TODO: SOURCE CODE</a>
</svelte:fragment>
</AppBar>
</svelte:fragment>
<!-- Page Route Content -->
<slot />
</AppShell>
+
+{#await import('$lib/components/ReloadPrompt.svelte') then { default: ReloadPrompt }}
+ <ReloadPrompt />
+{/await}
diff --git a/clients/www/src/routes/+page.svelte b/clients/www/src/routes/+page.svelte
index 2ea190a..84d1c45 100644
--- a/clients/www/src/routes/+page.svelte
+++ b/clients/www/src/routes/+page.svelte
@@ -1 +1,3 @@
-TODO: Draw the rest of the owl \ No newline at end of file
+<svelte:head>
+ <title>Zelda: Oracle of [Ages,Seasons] Passphrase Generator</title>
+</svelte:head> \ No newline at end of file
diff --git a/clients/www/svelte.config.js b/clients/www/svelte.config.js
index 79982cf..df04fc1 100644
--- a/clients/www/svelte.config.js
+++ b/clients/www/svelte.config.js
@@ -11,7 +11,7 @@ const config = {
kit: {
adapter: adapter(),
paths: {
- base: process.env.NODE_ENV === "production" ? "/oracle-client" : "",
+ base: process.env.NODE_ENV === "production" ? "/zorascript" : "",
}
}
};