From 544637e33ad23384ce33ff0c161b53b4cdc529f1 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 28 Sep 2022 12:28:47 -0700 Subject: animated balance --- src/routes/[username]/dashboard/+page.svelte | 30 ++++++++++++++++++---- src/routes/[username]/receive/+page.svelte | 20 +++++++-------- .../[username]/transactions/[...page]/+page.svelte | 4 +-- src/routes/invoice/[id]/+page.svelte | 10 ++++---- src/routes/invoice/[id]/paid/+page.svelte | 4 +-- 5 files changed, 44 insertions(+), 24 deletions(-) (limited to 'src/routes') diff --git a/src/routes/[username]/dashboard/+page.svelte b/src/routes/[username]/dashboard/+page.svelte index 22e480f3..c17001b5 100644 --- a/src/routes/[username]/dashboard/+page.svelte +++ b/src/routes/[username]/dashboard/+page.svelte @@ -1,13 +1,35 @@ diff --git a/src/routes/[username]/receive/+page.svelte b/src/routes/[username]/receive/+page.svelte index a1dc0a0e..f79e2df5 100644 --- a/src/routes/[username]/receive/+page.svelte +++ b/src/routes/[username]/receive/+page.svelte @@ -2,7 +2,7 @@ import { AppHeader, Icon } from '$comp'; import { goto } from '$app/navigation'; import { invoiceAmount, invoiceAmountFiat, selectedRate, user } from '$lib/store'; - import { f, s, post, warning } from '$lib/utils'; + import { f, s, post, warning, sats } from '$lib/utils'; import { page } from '$app/stores'; import { t } from '$lib/translations'; @@ -11,19 +11,19 @@ let amountSats = 0; let loading = false; - $: amount = parseInt(useFiat ? Math.round(amountFiat / ($selectedRate / 100000000)) : amountSats); + $: amount = parseInt(useFiat ? Math.round(amountFiat / ($selectedRate / sats)) : amountSats); - $: $invoiceAmount = parseInt(!amountSats ? amountFiat / ($selectedRate / 100000000) : amountSats); + $: $invoiceAmount = parseInt(!amountSats ? amountFiat / ($selectedRate / sats) : amountSats); $: $invoiceAmountFiat = parseInt( - amountFiat === 0 ? amountSats * ($selectedRate / 100000000) : amountFiat + amountFiat === 0 ? amountSats * ($selectedRate / sats) : amountFiat ); $: amountSatsFormatted = s(amountSats); - $: amountFiatConverted = f(amountSats * ($selectedRate / 100000000), $user.currency); + $: amountFiatConverted = f(amountSats * ($selectedRate / sats), $user.currency); - $: amountSatsConverted = s(amountFiat / ($selectedRate / 100000000)); + $: amountSatsConverted = s(amountFiat / ($selectedRate / sats)); const numPad = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0', '<']; @@ -65,7 +65,7 @@ amountFiat = 0; } } - } else if (value !== '<' && parseInt(amountSats + value) > 100000000) { + } else if (value !== '<' && parseInt(amountSats + value) > sats) { warning($t('user.receive.lessThan1BTCWarning')); } else { amountSats = parseInt(amountSats + value); @@ -125,11 +125,11 @@