diff options
| author | Adam Soltys <[email protected]> | 2024-11-07 21:16:25 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-11-08 09:27:40 -0800 |
| commit | 32fcc461cd43c8907df5e306d520bb671307eab1 (patch) | |
| tree | 0253780c569998b6c1a5f43026586e94916c3fee /src/routes/(app)/receive | |
| parent | be5aa52cea1d57c875cfb22d25c6a866b8de2239 (diff) | |
| download | coinos-ui-32fcc461cd43c8907df5e306d520bb671307eab1.tar.gz coinos-ui-32fcc461cd43c8907df5e306d520bb671307eab1.zip | |
svelte 5
Diffstat (limited to 'src/routes/(app)/receive')
| -rw-r--r-- | src/routes/(app)/receive/[...token]/+page.svelte | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/routes/(app)/receive/[...token]/+page.svelte b/src/routes/(app)/receive/[...token]/+page.svelte index 575c8269..3c081fdc 100644 --- a/src/routes/(app)/receive/[...token]/+page.svelte +++ b/src/routes/(app)/receive/[...token]/+page.svelte @@ -1,4 +1,6 @@ <script> + import { run } from 'svelte/legacy'; + import { page } from "$app/stores"; import { fly } from "svelte/transition"; import { enhance } from "$app/forms"; @@ -9,13 +11,12 @@ import Spinner from "$comp/Spinner.svelte"; import { back, fail, focus } from "$lib/utils"; - export let data; - export let form; + let { data = $bindable(), form } = $props(); let { token } = data; data.subject = data.user; - let el, text, pasted, w; + let el = $state(), text = $state(), pasted = $state(), w = $state(); let keypress = (e) => e.key === "Enter" && (e.preventDefault() || el.click()); @@ -23,7 +24,9 @@ text = await navigator.clipboard.readText(); }; - $: if (browser && pasted && text) el.click() && (pasted = false); + run(() => { + if (browser && pasted && text) el.click() && (pasted = false); + }); </script> <svelte:window bind:innerWidth={w} /> @@ -49,24 +52,24 @@ use:focus name="text" placeholder={$t("payments.voucherText")} - on:keypress={keypress} + onkeypress={keypress} class="w-full p-4 border rounded-xl h-32 text-xl" bind:value={text} - on:paste={() => (pasted = true)} + onpaste={() => (pasted = true)} autocapitalize="none" - /> +></textarea> </div> <div class="flex gap-2"> <a href="/scan" class="contents"> <button type="button" class="btn !w-auto flex-grow"> - <iconify-icon icon="ph:camera-bold" width="32" /> + <iconify-icon icon="ph:camera-bold" width="32"></iconify-icon> <div class="my-auto">{$t("user.send.scan")}</div> </button> </a> - <button type="button" class="btn !w-auto flex-grow" on:click={paste}> - <iconify-icon icon="ph:clipboard-text-bold" width="32" /> + <button type="button" class="btn !w-auto flex-grow" onclick={paste}> + <iconify-icon icon="ph:clipboard-text-bold" width="32"></iconify-icon> <div class="my-auto">{$t("user.send.paste")}</div> </button> </div> |
