diff options
| author | Adam Soltys <[email protected]> | 2023-03-29 08:08:41 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-03-29 08:08:41 -0700 |
| commit | f4507d0758c5e3e5e879d70cb1c5dbdbfd2186e8 (patch) | |
| tree | 2b838c3cf248b7d570459f7c5831e864be367a25 /src/components/Numpad.svelte | |
| parent | b51467da14e6a3def3ce12681b5222bf49484cd5 (diff) | |
| download | coinos-ui-f4507d0758c5e3e5e879d70cb1c5dbdbfd2186e8.tar.gz coinos-ui-f4507d0758c5e3e5e879d70cb1c5dbdbfd2186e8.zip | |
currency display
Diffstat (limited to 'src/components/Numpad.svelte')
| -rw-r--r-- | src/components/Numpad.svelte | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index 77a4f38b..20bfe561 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -7,17 +7,19 @@ export let amount, currency, fiat = !amount, + rate, submit = undefined; export let amountFiat = 0; + let arrow = '<'; $: update(amount, amountFiat); let update = (a, f) => { if (fiat) { - amount = Math.round(f / ($selectedRate / sats)); + amount = Math.round(f / (rate / sats)); } else { - amountFiat = ((a * $selectedRate) / sats).toFixed(2); + amountFiat = ((a * rate) / sats).toFixed(2); } }; @@ -60,7 +62,7 @@ amount = 0; } } - } else if (value !== '.' && value !== '<' && parseInt(amountFiat + value) > $selectedRate) { + } else if (value !== '.' && value !== '<' && parseInt(amountFiat + value) > rate) { warning($t('user.receive.lessThan1BTCWarning')); } else if (amountFiat !== 0 && amountFiat.match(/\.../)) { return; @@ -184,12 +186,10 @@ type="button" on:click={() => { if (fiat) { - amount = parseInt((amountFiat / ($selectedRate / sats)).toFixed(0)); + amount = parseInt((amountFiat / (rate / sats)).toFixed(0)); } else { amountFiat = - (amount * ($selectedRate / sats)).toFixed(2) > 0.0 - ? (amount * ($selectedRate / sats)).toFixed(2) - : 0; + (amount * (rate / sats)).toFixed(2) > 0.0 ? (amount * (rate / sats)).toFixed(2) : 0; } fiat = !fiat; }}><Icon icon="swap" style="inline hover:opacity-80" /></button |
