aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/receive.svelte
diff options
context:
space:
mode:
authorsecondl1ght <[email protected]>2022-07-29 21:29:18 -0600
committersecondl1ght <[email protected]>2022-07-29 21:29:18 -0600
commita038ce9711f8ae5945eba073c82aa2aeb2bcf5c3 (patch)
treeab1177d57a100b663ecd28367e686e0f2a6891f7 /src/routes/receive.svelte
parent49e7185efd45add123e0dbfcab077772b5ff22f6 (diff)
downloadcoinos-ui-a038ce9711f8ae5945eba073c82aa2aeb2bcf5c3.tar.gz
coinos-ui-a038ce9711f8ae5945eba073c82aa2aeb2bcf5c3.zip
start hooking up invoice screen
Diffstat (limited to 'src/routes/receive.svelte')
-rw-r--r--src/routes/receive.svelte22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte
index 338bc06c..095a2ba3 100644
--- a/src/routes/receive.svelte
+++ b/src/routes/receive.svelte
@@ -2,7 +2,7 @@
// in the future we will want to allow users to set their fiat currency in the settings
import { AppHeader, Icon } from '$comp';
import { goto } from '$app/navigation';
- import { invoiceAmount, rate } from '$lib/store';
+ import { invoiceAmount, invoiceAmountFiat, rate } from '$lib/store';
let useFiat = true;
let amountFiat = 0;
@@ -10,6 +10,9 @@
let message = '';
$: $invoiceAmount = parseInt(amountSats === 0 ? amountFiat / ($rate / 100000000) : amountSats);
+ $: $invoiceAmountFiat = parseInt(
+ amountFiat === 0 ? amountSats * ($rate / 100000000) : amountFiat
+ );
$: amountSatsFormatted = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(
amountSats
);
@@ -63,6 +66,7 @@
amountSats = amountSats.slice(0, amountSats.length - 1);
if (amountSats.length === 0) {
amountSats = 0;
+ amountFiat = 0;
}
}
} else if (value !== '<' && parseInt(amountSats + value) > 100000000) {
@@ -77,8 +81,8 @@
<AppHeader />
<!-- step 1 input amount and generate QR code -->
-{#if $rate}
- <div class="flex justify-center items-center mt-20 mb-3 px-3">
+<div class="flex justify-center items-center mt-20 mb-3 px-3">
+ {#if $rate}
<div class="space-y-5">
<!-- amounts -->
<div class="text-center">
@@ -165,11 +169,7 @@
>
</div>
</div>
- </div>
-{:else}
- <div class="px-3">
- <div
- class="w-full md:w-[300px] h-[475px] md:h-[485px] animate-pulse bg-gray-400 mt-20 mb-3 mx-auto rounded-xl"
- />
- </div>
-{/if}
+ {:else}
+ <div class="w-full md:w-[300px] h-[475px] md:h-[485px] animate-pulse bg-gray-400 rounded-xl" />
+ {/if}
+</div>