From 577f74832a1122c16bb2c747eab5acc07dbc7410 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 26 Sep 2022 23:13:47 -0700 Subject: hide toast on payment received --- src/routes/invoice/+server.js | 2 - src/routes/invoice/[id]/+layout.server.js | 6 + src/routes/invoice/[id]/+layout.svelte | 1 + src/routes/invoice/[id]/+page.server.js | 7 - src/routes/invoice/[id]/+page.svelte | 368 ++++++++++++++---------------- src/routes/invoice/[id]/paid/+page.svelte | 44 ++++ 6 files changed, 223 insertions(+), 205 deletions(-) create mode 100644 src/routes/invoice/[id]/+layout.server.js create mode 100644 src/routes/invoice/[id]/+layout.svelte delete mode 100644 src/routes/invoice/[id]/+page.server.js create mode 100644 src/routes/invoice/[id]/paid/+page.svelte (limited to 'src/routes/invoice') diff --git a/src/routes/invoice/+server.js b/src/routes/invoice/+server.js index 4538256c..d9a9739c 100644 --- a/src/routes/invoice/+server.js +++ b/src/routes/invoice/+server.js @@ -18,8 +18,6 @@ export async function POST({ request, parent }) { invoice.address = (await get('/address?network=bitcoin&type=bech32')).address; } - console.log('INVOICE', invoice); - return new Response( JSON.stringify(await post('/invoice', { invoice, user: { username } }, auth(request))), { headers: { 'content-type': 'application/json' } } diff --git a/src/routes/invoice/[id]/+layout.server.js b/src/routes/invoice/[id]/+layout.server.js new file mode 100644 index 00000000..e123c7d7 --- /dev/null +++ b/src/routes/invoice/[id]/+layout.server.js @@ -0,0 +1,6 @@ +import { get } from '$lib/utils'; + +export async function load({ params }) { + let { id } = params; + return { id, invoice: await get(`/invoice?uuid=${id}`) }; +} diff --git a/src/routes/invoice/[id]/+layout.svelte b/src/routes/invoice/[id]/+layout.svelte new file mode 100644 index 00000000..4fa864ce --- /dev/null +++ b/src/routes/invoice/[id]/+layout.svelte @@ -0,0 +1 @@ + diff --git a/src/routes/invoice/[id]/+page.server.js b/src/routes/invoice/[id]/+page.server.js deleted file mode 100644 index 3adba31a..00000000 --- a/src/routes/invoice/[id]/+page.server.js +++ /dev/null @@ -1,7 +0,0 @@ -import { get } from '$lib/utils'; - -export async function load({ params }) { - console.log('PARAMS', params); - let { id } = params; - return { id, invoice: await get(`/invoice?uuid=${id}`) }; -} diff --git a/src/routes/invoice/[id]/+page.svelte b/src/routes/invoice/[id]/+page.svelte index e8b1dd16..26566034 100644 --- a/src/routes/invoice/[id]/+page.svelte +++ b/src/routes/invoice/[id]/+page.svelte @@ -1,10 +1,9 @@ -{#if $invoices[id]?.received >= amount} -
- {#if typeof window !== 'undefined'} -
- -
- {/if} -

{$t('invoice.paymentSuccessful')}

-

- {totalAmountFormatted} -

-

({totalAmountSats} SAT)

- -
-{:else} -
- + +
+
- - - -
-
- {#if invoice.prompt} -
-
- - +
+ + +
+

{$t('invoice.addTipq')}

+ {#if !showCustomAmount} +
+ {tipAmountFormatted}{`(${tipAmountSats} SAT)`} + {Math.round(tipPercent)}%
-

{$t('invoice.addTipq')}

+ + (showMobileTip = false)} + /> + {/if} +
{#if !showCustomAmount} + {#each tipAmounts as amount} + + {/each} + {/if} + {#if showCustomAmount} +
+ $ + handleCustomTipAmount(e)} + class="pl-10" + placeholder="Other" + /> + + +
+ {:else}
- {tipAmountFormatted}{`(${tipAmountSats} SAT)`} (showCustomAmount = true)}>Custom amount - {Math.round(tipPercent)}%
- - (showMobileTip = false)} - /> {/if} -
- {#if !showCustomAmount} - {#each tipAmounts as amount} - - {/each} - {/if} - {#if showCustomAmount} -
- $ - handleCustomTipAmount(e)} - class="pl-10" - placeholder="Other" - /> - - -
- {:else} -
- -
- {/if} -
+
-