Add signer status, re-work bunker login

This commit is contained in:
Jon Staab
2025-07-29 10:53:48 -07:00
parent 69e1f97e72
commit 8697cc23be
9 changed files with 206 additions and 99 deletions
+26 -6
View File
@@ -1,16 +1,30 @@
<script lang="ts">
import {pushModal} from "@app/modal"
import InfoBunker from "@app/components/InfoBunker.svelte"
import {debounce} from "throttle-debounce"
import Scanner from "@lib/components/Scanner.svelte"
import Button from "@lib/components/Button.svelte"
import Field from "@lib/components/Field.svelte"
import Icon from "@lib/components/Icon.svelte"
import InfoBunker from "@app/components/InfoBunker.svelte"
import type {Nip46Controller} from "@app/nip46"
import {pushModal} from "@app/modal"
type Props = {
bunker: string
loading: boolean
controller: Nip46Controller
}
let {loading, bunker = $bindable("")}: Props = $props()
const {controller}: Props = $props()
const {loading, bunker} = controller
const toggleScanner = () => {
showScanner = !showScanner
}
const onScan = debounce(1000, async (data: string) => {
showScanner = false
$bunker = data
})
let showScanner = $state(false)
</script>
<Field>
@@ -20,7 +34,10 @@
{#snippet input()}
<label class="input input-bordered flex w-full items-center gap-2">
<Icon icon="cpu" />
<input disabled={loading} bind:value={bunker} class="grow" placeholder="bunker://" />
<input disabled={$loading} bind:value={$bunker} class="grow" placeholder="bunker://" />
<Button onclick={toggleScanner}>
<Icon icon="qr-code" />
</Button>
</label>
{/snippet}
{#snippet info()}
@@ -30,3 +47,6 @@
</p>
{/snippet}
</Field>
{#if showScanner}
<Scanner onscan={onScan} />
{/if}