diff options
| author | Adam Soltys <[email protected]> | 2024-01-29 15:19:38 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-01-29 15:19:38 -0800 |
| commit | b54d3afc6465acd5e518a8b4970be1ab75b361b1 (patch) | |
| tree | c2ab7a8d91140ec6a60bd2b76e25c68a0355ee38 /src/routes/(app)/send | |
| parent | a7dd56863aada46964a4277f0a5940de68c332b5 (diff) | |
| download | coinos-ui-b54d3afc6465acd5e518a8b4970be1ab75b361b1.tar.gz coinos-ui-b54d3afc6465acd5e518a8b4970be1ab75b361b1.zip | |
autowithdrawals
Diffstat (limited to 'src/routes/(app)/send')
| -rw-r--r-- | src/routes/(app)/send/[...text]/+page.svelte | 11 | ||||
| -rw-r--r-- | src/routes/(app)/send/invoice/[id]/+page.server.js | 1 | ||||
| -rw-r--r-- | src/routes/(app)/send/invoice/[id]/+page.svelte | 11 |
3 files changed, 12 insertions, 11 deletions
diff --git a/src/routes/(app)/send/[...text]/+page.svelte b/src/routes/(app)/send/[...text]/+page.svelte index 41b58bfb..489650a5 100644 --- a/src/routes/(app)/send/[...text]/+page.svelte +++ b/src/routes/(app)/send/[...text]/+page.svelte @@ -9,7 +9,7 @@ import Avatar from "$comp/Avatar.svelte"; import Icon from "$comp/Icon.svelte"; import Spinner from "$comp/Spinner.svelte"; - import { back, fail } from "$lib/utils"; + import { back, fail, focus } from "$lib/utils"; export let data; export let form; @@ -18,10 +18,9 @@ let { contacts } = data; let w; - let el, textarea, text; - let placeholder = $t("user.send.placeholder"); + let el, text; + - $: $page && setTimeout(() => w > 800 && textarea?.focus(), 0); let keypress = (e) => e.key === "Enter" && (e.preventDefault() || el.click()); let paste = async () => { @@ -48,12 +47,12 @@ <div class="mb-2"> <textarea + use:focus name="text" - {placeholder} + placeholder={$t("user.send.placeholder")} on:keypress={keypress} class="w-full p-4 border rounded-xl h-48" bind:value={text} - bind:this={textarea} /> </div> diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index 88017362..c6b0a9a4 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -41,6 +41,7 @@ export const actions = { await post("/payments", body, auth(cookies)); } catch (e) { + console.log("payment failed", params, e); return fail(400, { message: e.message }); } diff --git a/src/routes/(app)/send/invoice/[id]/+page.svelte b/src/routes/(app)/send/invoice/[id]/+page.svelte index e857f717..dd637d70 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.svelte +++ b/src/routes/(app)/send/invoice/[id]/+page.svelte @@ -35,8 +35,8 @@ amountFiat = af; }; - let loading; - let submit = () => (loading = true); + let submitting; + let submit = () => (submitting = true); let external = async () => { let invoice = { type: "lightning", amount, currency }; @@ -52,8 +52,8 @@ $: update(form); let update = () => { - if (form?.message.includes("pin")) $pin = undefined; - loading = false; + if (form?.message?.includes("pin")) $pin = undefined; + submitting = false; }; // onMount(async () => { @@ -152,8 +152,9 @@ use:focus type="submit" class="opacity-100 hover:opacity-80'} rounded-2xl border py-3 font-bold mx-auto mt-2 bg-black text-white px-4 w-24" + disabled={submitting} > - {#if loading} + {#if submitting} <Spinner /> {:else} {$t("payments.send")} |
