From c0ba00eae40dde1811fcb52099840b2b42120271 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 20 Aug 2025 13:42:50 -0700 Subject: numpad fixes --- src/components/Numpad.svelte | 67 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 13 deletions(-) (limited to 'src/components/Numpad.svelte') diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index 00547e6a..8ebbfdf1 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -3,14 +3,15 @@ import Left from "$comp/Left.svelte"; import { f, s, focus, warning, sat, sats } from "$lib/utils"; import { t } from "$lib/translations"; + import { fiat as fiatStore } from "$lib/store"; // ---- Props (Svelte 5 runes) ---- let { - amount = $bindable(0), + amount = $bindable(), currency = "USD", - fiat = $bindable(true), + fiat = $bindable(), element, - rate, + rate = $bindable(), locale, submit = undefined, amountFiat = 0, @@ -217,12 +218,28 @@ sel.removeAllRanges(); sel.addRange(range); }); + + $fiatStore = fiat; }; const arrow = "<"; - const numPad = ["1","2","3","4","5","6","7","8","9","00","0",arrow]; + const numPad = [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "00", + "0", + arrow, + ]; onMount(() => { + fiat = $fiatStore; if (fiat) { const cents = Math.round((parseFloat(amountFiat || "0") || 0) * 100); fiatDigits = Math.max(0, cents).toString(); @@ -237,12 +254,18 @@
-
+
{#if fiat} {#if position === "before"}{symbol}{/if} {:else} - + {/if}
@@ -279,7 +302,11 @@ }} > {#if fiat} - + {s(amount, locale)} {:else} {f(amountFiat, currency, locale)} @@ -290,15 +317,29 @@
{#each numPad as value} {#if value === arrow} - {:else} - {/if} -- cgit v1.2.3