From cbd131cc69dc84e48c57596667a993a9d1e78a77 Mon Sep 17 00:00:00 2001 From: Danny Morabito Date: Thu, 17 Jul 2025 18:50:41 +0200 Subject: [PATCH] add visual flourish --- src/lib/components/PasswordDialog.svelte | 77 ++++++++++++--------- src/lib/components/ToggleSwitch.svelte | 88 ++++++++++++++++++++++++ src/lib/settings.svelte.ts | 28 ++++++++ src/lib/style.css | 14 ++-- src/routes/+layout.svelte | 82 ++++------------------ src/routes/settings/+page.svelte | 9 +++ 6 files changed, 184 insertions(+), 114 deletions(-) create mode 100644 src/lib/components/ToggleSwitch.svelte create mode 100644 src/lib/settings.svelte.ts diff --git a/src/lib/components/PasswordDialog.svelte b/src/lib/components/PasswordDialog.svelte index c69e063..95694a3 100644 --- a/src/lib/components/PasswordDialog.svelte +++ b/src/lib/components/PasswordDialog.svelte @@ -6,7 +6,8 @@ openWallet, } from "$lib/wallet.svelte"; import { browser } from "$app/environment"; - import { onMount } from "svelte"; + import { onMount, tick } from "svelte"; + import { fly } from "svelte/transition"; let { onunlock }: { onunlock: () => void } = $props(); @@ -14,8 +15,11 @@ let password = $state(""); let error = $state(""); let isValidating = $state(false); + let show = $state(false); - onMount(() => { + onMount(async () => { + show = true; + await tick(); dialogEl?.showModal(); }); @@ -41,45 +45,50 @@ } - -

Unlock Wallet

-

Enter your wallet password to decrypt your seed.

- {#if error} -

- {error} -

- {/if} - { - if (e.key === "Enter" && !isValidating) { - attemptUnlock(); - } - }} - /> -
- -
-
+ onkeydown={(e) => { + if (e.key === "Enter" && !isValidating) { + attemptUnlock(); + } + }} + /> +
+ +
+ +{/if} diff --git a/src/lib/settings.svelte.ts b/src/lib/settings.svelte.ts new file mode 100644 index 0000000..8b99cf0 --- /dev/null +++ b/src/lib/settings.svelte.ts @@ -0,0 +1,28 @@ +import { persistentDbWritable } from "$lib/index"; +import type { Writable } from "svelte/store"; +import Dexie, { type Table } from "dexie"; + +interface MetaEntry { + key: string; + value: string; +} + +class SettingsDB extends Dexie { + meta!: Table; + + constructor() { + super("settings"); + this.version(1).stores({ + meta: "&key" + }); + } +} + +const settingsDB = new SettingsDB(); + +export const shaderEnabled: Writable = persistentDbWritable( + "shaderEnabled", + true, + + settingsDB +); diff --git a/src/lib/style.css b/src/lib/style.css index 77fa773..09531f2 100644 --- a/src/lib/style.css +++ b/src/lib/style.css @@ -31,8 +31,7 @@ body { letter-spacing: 0.5px; line-height: 1.2; text-shadow: 1px 1px 0 #000; - overflow-x: hidden; - overflow-y: auto; + overflow: hidden; } .app-wrapper { @@ -44,14 +43,6 @@ body { padding: 2rem 1rem 4rem; } -.container { - width: 100%; - max-width: 28rem; - display: flex; - flex-direction: column; - align-items: stretch; -} - .send-receive-buttons { display: flex; gap: 0.75rem; @@ -68,6 +59,9 @@ body { box-shadow: 0 0 0 4px #000, 0 0 0 8px var(--primary-color); + .header { + cursor: pointer; + } } .retro-card::before { diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index eef1997..7b59dbe 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -10,6 +10,9 @@ import SplashScreen from "$lib/components/SplashScreen.svelte"; import ErrorDialog from "$lib/components/ErrorDialog.svelte"; import InstallPrompt from "$lib/components/InstallPrompt.svelte"; + import { online } from "$lib/online.svelte"; + import Offline from "$lib/components/Offline.svelte"; + import { shaderEnabled } from "$lib/settings.svelte"; type AppError = { message: string; @@ -93,7 +96,7 @@ Portal BTC -
+
{#if !$online} {:else if showInstallPrompt && deferredPrompt} @@ -121,81 +124,20 @@