From a038ce9711f8ae5945eba073c82aa2aeb2bcf5c3 Mon Sep 17 00:00:00 2001
From: secondl1ght <85003930+secondl1ght@users.noreply.github.com>
Date: Fri, 29 Jul 2022 21:29:18 -0600
Subject: start hooking up invoice screen
---
src/routes/receive.svelte | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
(limited to 'src/routes/receive.svelte')
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 @@