From 9e07792fcdd0ba0b7c07a20fe83db54597388e26 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 28 Sep 2022 20:21:58 -0700 Subject: withdraw page and other fixups --- src/routes/[username]/dashboard/+page.svelte | 144 ++++++--------------------- src/routes/scan/+page.svelte | 24 +++++ src/routes/send/+page.svelte | 62 ++++++++++++ 3 files changed, 115 insertions(+), 115 deletions(-) create mode 100644 src/routes/scan/+page.svelte create mode 100644 src/routes/send/+page.svelte (limited to 'src/routes') diff --git a/src/routes/[username]/dashboard/+page.svelte b/src/routes/[username]/dashboard/+page.svelte index a580f349..55fe69ee 100644 --- a/src/routes/[username]/dashboard/+page.svelte +++ b/src/routes/[username]/dashboard/+page.svelte @@ -13,48 +13,29 @@ $: animateRate($rate); let animateRate = (newRate) => { - if (!accountBalanceFiat) return; + if (!accountBalanceFiat) return; let t = 0; - let newBalance = (user.account.balance * newRate / sats); - let oldBalance = parseFloat(accountBalanceFiat); - let diff = oldBalance - newBalance; + let newBalance = (user.account.balance * newRate) / sats; + let oldBalance = parseFloat(accountBalanceFiat); + let diff = oldBalance - newBalance; clearInterval(interval); interval = setInterval(() => { let delta = diff * ease(t / 100); - accountBalanceFiat = (oldBalance - delta).toFixed(2) + accountBalanceFiat = (oldBalance - delta).toFixed(2); if (t > 80) clearInterval(interval); t++; }, 10); }; $: user = data.user; - $: accountBalanceFiat = accountBalanceFiat || user && $rate && (user.account.balance * $rate / sats).toFixed(2); + $: accountBalanceFiat = + accountBalanceFiat || (user && $rate && ((user.account.balance * $rate) / sats).toFixed(2)); let payreq = '', payreqField, - withdrawing, loading; - let toggle = async () => { - payreq = ''; - withdrawing = !withdrawing; - await tick(); - if (withdrawing) payreqField.focus(); - }; - - let withdraw = async () => { - loading = true; - try { - await post('/withdraw', { payreq }); - withdrawing = false; - loading = false; - } catch (e) { - failure(e.message); - loading = false; - } - }; - $: btcPrice = f($selectedRate, user.currency); $: accountBalanceBtc = user.account.balance / sats; @@ -75,96 +56,29 @@

- {withdrawing ? 'Withdraw' : 'Dashboard'} + {$t('user.dashboard.dashboard')}

- {#if !withdrawing} - - - - - - - -

- {$t('user.dashboard.ACCOUNT_BALANCE')} -

- - {accountBalanceSats} SAT - - {$selectedRate ? f(accountBalanceFiat, user.currency) : $t('user.dashboard.fetchingRate')} + {$t('user.dashboard.accountBalance')} + + + {accountBalanceSats} SAT + + {$selectedRate + ? f(accountBalanceFiat, user.currency) + : $t('user.dashboard.fetchingRate')} + +
+ - -
- - -
- {:else} -
- - -
- - - -
- - - - - -
- {/if} + +
diff --git a/src/routes/scan/+page.svelte b/src/routes/scan/+page.svelte new file mode 100644 index 00000000..5c8c09f6 --- /dev/null +++ b/src/routes/scan/+page.svelte @@ -0,0 +1,24 @@ + + + + +
+
diff --git a/src/routes/send/+page.svelte b/src/routes/send/+page.svelte new file mode 100644 index 00000000..777f9766 --- /dev/null +++ b/src/routes/send/+page.svelte @@ -0,0 +1,62 @@ + + + + +
+
+ + + +
+ + + +
+ +
+
+
+
+ + +
-- cgit v1.2.3