aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send/lightning
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-07 21:16:25 -0800
committerAdam Soltys <[email protected]>2024-11-08 09:27:40 -0800
commit32fcc461cd43c8907df5e306d520bb671307eab1 (patch)
tree0253780c569998b6c1a5f43026586e94916c3fee /src/routes/(app)/send/lightning
parentbe5aa52cea1d57c875cfb22d25c6a866b8de2239 (diff)
downloadcoinos-ui-32fcc461cd43c8907df5e306d520bb671307eab1.tar.gz
coinos-ui-32fcc461cd43c8907df5e306d520bb671307eab1.zip
svelte 5
Diffstat (limited to 'src/routes/(app)/send/lightning')
-rw-r--r--src/routes/(app)/send/lightning/[payreq]/+page.svelte32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/routes/(app)/send/lightning/[payreq]/+page.svelte b/src/routes/(app)/send/lightning/[payreq]/+page.svelte
index 659b0e51..6b9fe4e2 100644
--- a/src/routes/(app)/send/lightning/[payreq]/+page.svelte
+++ b/src/routes/(app)/send/lightning/[payreq]/+page.svelte
@@ -1,4 +1,6 @@
<script>
+ import { run } from "svelte/legacy";
+
import { t } from "$lib/translations";
import { enhance } from "$app/forms";
import Icon from "$comp/Icon.svelte";
@@ -8,8 +10,7 @@
import { back, fiat, f, s, focus } from "$lib/utils";
import { rate, pin } from "$lib/store";
- export let data;
- export let form;
+ let { data, form } = $props();
let { payreq } = $page.params;
let {
@@ -17,10 +18,9 @@
ourfee,
rates,
user: { currency },
- } = data;
- let a;
+ } = $state(data);
+ let a = $state();
- $: reload(data);
let reload = (data) => {
({
alias,
@@ -31,13 +31,10 @@
if (!$rate) $rate = rates[currency];
};
- $: amount = form?.amount || data.amount;
- $: maxfee = Math.max(5, Math.round(amount * 0.005));
- let showMax;
+ let showMax = $state();
- let loading;
+ let loading = $state();
let submit = () => (loading = true);
- $: update(form);
let update = () => {
if (form?.message?.includes("pin")) $pin = undefined;
loading = false;
@@ -45,6 +42,17 @@
let show;
let toggle = () => (show = !show);
+ run(() => {
+ reload(data);
+ });
+ let amount = $derived(form?.amount || data.amount);
+ let maxfee;
+ run(() => {
+ maxfee = Math.max(5, Math.round(amount * 0.005));
+ });
+ run(() => {
+ update(form);
+ });
</script>
<div class="container px-4 max-w-xl mx-auto text-center space-y-2">
@@ -89,7 +97,7 @@
<form
method="POST"
use:enhance
- on:submit={submit}
+ onsubmit={submit}
action="?/send"
class="space-y-2"
>
@@ -135,7 +143,7 @@
</button>
{#if !(form?.message || showMax)}
- <button type="button" class="btn" on:click={() => (showMax = !showMax)}
+ <button type="button" class="btn" onclick={() => (showMax = !showMax)}
>Advanced settings</button
>
<input name="maxfee" type="hidden" bind:value={maxfee} />