From 211511570b447ad0256a992bf8e3b5dfa8a82fb7 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 26 Feb 2026 22:10:12 -0800 Subject: fix amount toggles --- src/components/Amount.svelte | 18 ++++-------- src/components/InvoiceData.svelte | 7 ++--- src/components/Lnurlw.svelte | 18 ++++-------- src/components/Numpad.svelte | 16 +++++------ src/components/Payments.svelte | 13 ++++----- .../(app)/ecash/[id]/[...version]/+layout.svelte | 30 ++++++++------------ src/routes/(app)/fund/[id]/withdraw/+page.svelte | 7 ++--- src/routes/(app)/invoice/[id]/tip/+page.svelte | 32 ++++++++++------------ src/routes/(app)/payment/[id]/+page.svelte | 26 +++++++----------- src/routes/(app)/payment/[id]/plain/+page.svelte | 21 ++++---------- src/routes/(app)/payments/[...page]/+page.svelte | 12 ++++---- .../send/lightning/[payreq]/[...memo]/+page.svelte | 7 ++--- src/routes/(app)/settings/nostr/+page.svelte | 7 ++--- 13 files changed, 79 insertions(+), 135 deletions(-) (limited to 'src') diff --git a/src/components/Amount.svelte b/src/components/Amount.svelte index f368e96c..1f2b1f29 100644 --- a/src/components/Amount.svelte +++ b/src/components/Amount.svelte @@ -33,25 +33,17 @@ onclick={toggleFiat} aria-label="Toggle currency display" > - {#if !canShowFiat} - - {/if} - {#if canShowFiat} - {f(toFiat(amount, rate), currency, locale)} - {:else} - {s(amount, locale)} - {/if} + + {f(toFiat(amount, rate), currency, locale)} + {s(amount, locale)} {#if tip}
+
- {#if canShowFiat} - {f(toFiat(tip, rate), currency, locale)} - {:else} - {s(tip, locale)} - {/if} + {f(toFiat(tip, rate), currency, locale)} + {s(tip, locale)}
{/if} diff --git a/src/components/InvoiceData.svelte b/src/components/InvoiceData.svelte index 105eb471..b572ed93 100644 --- a/src/components/InvoiceData.svelte +++ b/src/components/InvoiceData.svelte @@ -66,11 +66,8 @@
{i.quantity}
{i.name}
- {#if $fiat} -
{f(itemTotal, currency)}
- {:else} -
{sat(btc(itemTotal, rate))}
- {/if} +
{f(itemTotal, currency)}
+
{sat(btc(itemTotal, rate))}
{/each} diff --git a/src/components/Lnurlw.svelte b/src/components/Lnurlw.svelte index 0cc6f824..b952b082 100644 --- a/src/components/Lnurlw.svelte +++ b/src/components/Lnurlw.svelte @@ -48,13 +48,10 @@ {#if minWithdrawable === maxWithdrawable}
- {#if $fiat} -
{f(amountFiat, currency)}
- {:else} -
- ⚡️{`${s(amount)}`} -
- {/if} +
{f(amountFiat, currency)}
+
+ ⚡️{`${s(amount)}`} +
{:else} @@ -78,11 +75,8 @@ disabled={submitting} onkeydown={setMax} > - {#if $fiat} - Max {f((Math.floor(maxWithdrawable / 1000) * rate) / sats, currency)} - {:else} - Max ⚡️{s(Math.floor(maxWithdrawable / 1000))} - {/if} + Max {f((Math.floor(maxWithdrawable / 1000) * rate) / sats, currency)} + Max ⚡️{s(Math.floor(maxWithdrawable / 1000))} {/if} diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index 5ba6e244..8e4cba13 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -255,12 +255,11 @@
- {#if fiat} + {#if position === "before"}{symbol}{/if} - {:else} - - {/if} + +
@@ -302,12 +301,11 @@ swap(); }} > - {#if fiat} + {s(amount, locale)} - {:else} - {f(amountFiat, currency, locale)} - {/if} + + {f(amountFiat, currency, locale)}
diff --git a/src/components/Payments.svelte b/src/components/Payments.svelte index b616742f..a16bf4ea 100644 --- a/src/components/Payments.svelte +++ b/src/components/Payments.svelte @@ -24,14 +24,11 @@ >
diff --git a/src/routes/(app)/ecash/[id]/[...version]/+layout.svelte b/src/routes/(app)/ecash/[id]/[...version]/+layout.svelte index 5da0c1c3..217b9ced 100644 --- a/src/routes/(app)/ecash/[id]/[...version]/+layout.svelte +++ b/src/routes/(app)/ecash/[id]/[...version]/+layout.svelte @@ -27,13 +27,10 @@ {#if amount > 0}
- {#if $fiat} -
{f(amountFiat, currency)}
- {:else} -
- ⚡️{`${s(amount)}`} -
- {/if} +
{f(amountFiat, currency)}
+
+ ⚡️{`${s(amount)}`} +
{/if} @@ -44,17 +41,14 @@ {#if spent > 0}
- {#if $fiat} -
- {f(spentFiat, currency)} - {$t("payments.spent")} -
- {:else} -
- ⚡️{`${s(spent)}`} - {$t("payments.spent")} -
- {/if} +
+ {f(spentFiat, currency)} + {$t("payments.spent")} +
+
+ ⚡️{`${s(spent)}`} + {$t("payments.spent")} +
{/if} diff --git a/src/routes/(app)/fund/[id]/withdraw/+page.svelte b/src/routes/(app)/fund/[id]/withdraw/+page.svelte index 64597d53..4ef2ad62 100644 --- a/src/routes/(app)/fund/[id]/withdraw/+page.svelte +++ b/src/routes/(app)/fund/[id]/withdraw/+page.svelte @@ -56,11 +56,8 @@ disabled={submitting} onkeydown={setMax} > - {#if $fiat} - Max {f((balance * rate) / sats, currency, locale)} - {:else} - Max ⚡️{s(balance)} - {/if} + Max {f((balance * rate) / sats, currency, locale)} + Max ⚡️{s(balance)}
{/snippet} @@ -144,14 +141,11 @@ onclick={toggleFiat} aria-label="Toggle currency display" > - {#if $fiat} - {f(toFiat(a, rate), currency, userLocale)} - {:else} - - - {s(a, userLocale)} - - {/if} + {f(toFiat(a, rate), currency, userLocale)} + + + {s(a, userLocale)} +
{format(new Date(created), "MMM d, yyyy", { locale })}{format(new Date(created), "h:mmaaa", { locale })} diff --git a/src/routes/(app)/payment/[id]/plain/+page.svelte b/src/routes/(app)/payment/[id]/plain/+page.svelte index 41cdd25b..1efe2c32 100644 --- a/src/routes/(app)/payment/[id]/plain/+page.svelte +++ b/src/routes/(app)/payment/[id]/plain/+page.svelte @@ -40,11 +40,8 @@
Amount
- {#if $fiat} - {f(toFiat(a, rate), currency)} - {:else} - {s(a)} - {/if} + {f(toFiat(a, rate), currency)} + {s(a)}
@@ -52,11 +49,8 @@
Tip
- {#if $fiat} - {f(toFiat(tip, rate), currency)} - {:else} - {s(tip)} - {/if} + {f(toFiat(tip, rate), currency)} + {s(tip)} ({Math.round((tip * 100) / Math.abs(a))}%)
@@ -64,11 +58,8 @@
Total
- {#if $fiat} - {f(toFiat(a + (tip || 0), rate), currency)} - {:else} - {s(a + (tip || 0))} - {/if} + {f(toFiat(a + (tip || 0), rate), currency)} + {s(a + (tip || 0))}
{/if} diff --git a/src/routes/(app)/payments/[...page]/+page.svelte b/src/routes/(app)/payments/[...page]/+page.svelte index bc207aad..1d5a0407 100644 --- a/src/routes/(app)/payments/[...page]/+page.svelte +++ b/src/routes/(app)/payments/[...page]/+page.svelte @@ -151,11 +151,11 @@

{$t("payments.header")}

-
+
{#each presets as { start, end, title }, i} {title} @@ -163,17 +163,17 @@ {/each}
-
+
{#if pages.length > 1} {#each pages as _, i} {#if showPage(i)} - -
+ +
{i + 1}
{:else if isEllipsis(i)} -
...
+
...
{/if} {/each} {/if} diff --git a/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte b/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte index 38407a0d..fc80e161 100644 --- a/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte +++ b/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte @@ -120,11 +120,8 @@
- {#if $fiat} -

{f(toFiat(ourfee as number, $rate as number), currency)}

- {:else} -

⚡️{s(ourfee)}

- {/if} +

{f(toFiat(ourfee as number, $rate as number), currency)}

+

⚡️{s(ourfee)}

diff --git a/src/routes/(app)/settings/nostr/+page.svelte b/src/routes/(app)/settings/nostr/+page.svelte index 844433c3..90c7bf1e 100644 --- a/src/routes/(app)/settings/nostr/+page.svelte +++ b/src/routes/(app)/settings/nostr/+page.svelte @@ -70,11 +70,8 @@
- {#if $fiat && $rate} - {f((app.spent * ($rate as number)) / sats, user.currency, locale)} / {f((app.max_amount * ($rate as number)) / sats, user.currency, locale)} - {:else} - {s(app.spent, locale)} / {s(app.max_amount, locale)} - {/if} + {f((app.spent * ($rate as number)) / sats, user.currency, locale)} / {f((app.max_amount * ($rate as number)) / sats, user.currency, locale)} + {s(app.spent, locale)} / {s(app.max_amount, locale)}
{#if app.budget_renewal !== "never"} -- cgit v1.2.3