aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-14 13:32:52 -0800
committerAdam Soltys <[email protected]>2024-11-14 16:09:51 -0800
commit0f35462ebdde3701e8fe927b3debace9abf79305 (patch)
tree786d8c833e16762b87a193fb4c09d634784f7744 /src/routes/(app)/send
parent614fbd99b7963ec89666b8b4252fa5f73c81653c (diff)
downloadcoinos-ui-0f35462ebdde3701e8fe927b3debace9abf79305.tar.gz
coinos-ui-0f35462ebdde3701e8fe927b3debace9abf79305.zip
payment amount helpers
Diffstat (limited to 'src/routes/(app)/send')
-rw-r--r--src/routes/(app)/send/lightning/[payreq]/+page.svelte25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/routes/(app)/send/lightning/[payreq]/+page.svelte b/src/routes/(app)/send/lightning/[payreq]/+page.svelte
index af3e09f4..d8bd5f8c 100644
--- a/src/routes/(app)/send/lightning/[payreq]/+page.svelte
+++ b/src/routes/(app)/send/lightning/[payreq]/+page.svelte
@@ -1,9 +1,7 @@
<script>
- import { run } from "svelte/legacy";
-
import { t } from "$lib/translations";
import { enhance } from "$app/forms";
- import Icon from "$comp/Icon.svelte";
+ import Amount from "$comp/Amount.svelte";
import Numpad from "$comp/Numpad.svelte";
import Spinner from "$comp/Spinner.svelte";
import { page } from "$app/stores";
@@ -21,15 +19,7 @@
} = $state(data);
let a = $state();
- let reload = (data) => {
- ({
- alias,
- ourfee,
- rates,
- user: { currency },
- } = data);
- if (!$rate) $rate = rates[currency];
- };
+ $effect(() => ($rate ||= rates[currency]));
let showMax = $state();
@@ -42,17 +32,8 @@
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);
- });
+ let maxfee = $state(Math.max(5, Math.round(amount * 0.005)));
</script>
<div class="container px-4 max-w-xl mx-auto text-center space-y-2">