aboutsummaryrefslogtreecommitdiffstats
path: root/clients
diff options
context:
space:
mode:
Diffstat (limited to 'clients')
-rw-r--r--clients/www/LICENSE21
-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, 66 insertions, 39 deletions
diff --git a/clients/www/LICENSE b/clients/www/LICENSE
new file mode 100644
index 0000000..f328a5d
--- /dev/null
+++ b/clients/www/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2024 Matthew Strapp
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE. \ No newline at end of file
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" : "",
}
}
};