diff options
| author | Adam Soltys <[email protected]> | 2024-11-14 13:32:52 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-11-14 16:09:51 -0800 |
| commit | 0f35462ebdde3701e8fe927b3debace9abf79305 (patch) | |
| tree | 786d8c833e16762b87a193fb4c09d634784f7744 /src/routes/(app)/payment | |
| parent | 614fbd99b7963ec89666b8b4252fa5f73c81653c (diff) | |
| download | coinos-ui-0f35462ebdde3701e8fe927b3debace9abf79305.tar.gz coinos-ui-0f35462ebdde3701e8fe927b3debace9abf79305.zip | |
payment amount helpers
Diffstat (limited to 'src/routes/(app)/payment')
| -rw-r--r-- | src/routes/(app)/payment/[id]/+page.svelte | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index 45dc8642..94226931 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -25,31 +25,6 @@ let { user, payment: p } = $state(data); let locale = locales[user.language]; - let refresh = (d) => { - ({ user, payment: p } = d); - ({ - id, - hash, - amount, - created, - confirmed, - memo, - rate, - type, - ref, - path, - tip, - ourfee, - fee, - currency, - } = p); - - if (amount > 0) [txid, vout] = ref.split(":"); - else txid = hash; - - if (!fee) fee = 0; - }; - let { username } = user; let { id, @@ -64,9 +39,10 @@ path, tip, ourfee, - fee, + fee = 0, currency, - } = $state(p); + } = $derived(p); + let [txid, vout] = $derived(amount > 0 ? ref.split(":") : [hash]); let a = Math.abs(amount); let expl = { @@ -87,11 +63,6 @@ } }; - let txid = $state(), - vout = $state(); - if (amount > 0) [txid, vout] = ref.split(":"); - else txid = hash; - let direction = $state(""); onMount(() => { direction = amount > 0 ? $t("payments.from") : $t("payments.to"); @@ -100,9 +71,6 @@ direction = direction[0].toUpperCase() + direction.substr(1, direction.length); }); - run(() => { - refresh(data); - }); </script> {#snippet field(title, amount)} @@ -111,7 +79,7 @@ <div class="flex gap-2 items-end"> <div class="flex items-center"> <iconify-icon icon="ph:lightning-fill" class="text-yellow-300" - ></iconify-icon>{amount} + ></iconify-icon>{s(amount)} </div> <span class="text-secondary text-lg"> {f(toFiat(amount, rate), currency)} |
