From 59d43ba294e49cbb46ea4d2d0ddb0d22bbc7ba6e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 4 Oct 2022 20:28:29 -0700 Subject: tipping fixes --- src/routes/invoice/[id]/+page.server.js | 5 +++++ src/routes/invoice/[id]/+page.svelte | 9 +-------- src/routes/invoice/[id]/paid/+page.svelte | 23 +++++++++-------------- 3 files changed, 15 insertions(+), 22 deletions(-) create mode 100644 src/routes/invoice/[id]/+page.server.js (limited to 'src/routes/invoice') diff --git a/src/routes/invoice/[id]/+page.server.js b/src/routes/invoice/[id]/+page.server.js new file mode 100644 index 00000000..1068f273 --- /dev/null +++ b/src/routes/invoice/[id]/+page.server.js @@ -0,0 +1,5 @@ +import invoice from '$lib/invoice'; + +export const actions = { + default: invoice +}; diff --git a/src/routes/invoice/[id]/+page.svelte b/src/routes/invoice/[id]/+page.svelte index 9d140bd5..04a31813 100644 --- a/src/routes/invoice/[id]/+page.svelte +++ b/src/routes/invoice/[id]/+page.svelte @@ -19,7 +19,6 @@ user: { username, currency } } = invoice; - let showCustomAmount = false; let showMobileTip = false; let qr; @@ -39,15 +38,13 @@ user: { username, currency } } = invoice); - amount -= tip; - tipPercent = (tip / amount) * 100; }; $: tip = Math.round((amount / 100) * tipPercent); $invoices[id] = { amount, id, rate, received, text, tip, username }; - $: $invoices[id]?.received >= $invoices[id]?.amount && goto(`/invoice/${id}/paid`); + $: browser && $invoices[id]?.received >= $invoices[id]?.amount && goto(`/invoice/${id}/paid`); $: amountFiat = parseFloat(((amount * rate) / sats).toFixed(2)); @@ -73,15 +70,11 @@ {#if invoice.prompt} diff --git a/src/routes/invoice/[id]/paid/+page.svelte b/src/routes/invoice/[id]/paid/+page.svelte index 456ee3ba..1b212a92 100644 --- a/src/routes/invoice/[id]/paid/+page.svelte +++ b/src/routes/invoice/[id]/paid/+page.svelte @@ -1,15 +1,19 @@ -
- {#if browser} -
- -
- {/if} +
+
+ +

{$t('invoice.paymentSuccessful')}

{f(amountFiat, invoice.currency)} -- cgit v1.2.3