diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/invoice.js | 4 | ||||
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/+layout.svelte | 1 | ||||
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/+page.svelte | 7 | ||||
| -rw-r--r-- | src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte | 5 |
4 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/invoice.js b/src/lib/invoice.js index 98f6f2ca..d2d3d13d 100644 --- a/src/lib/invoice.js +++ b/src/lib/invoice.js @@ -28,7 +28,5 @@ export default async ({ cookies, request, url }) => { if (invoice.memoPrompt && !invoice.memo) { redirect(307, `/${user.username}/invoice/${id}/memo`); - } - - else redirect(307, `/${user.username}/invoice/${id}`); + } else redirect(307, `/${user.username}/invoice/${id}`); }; diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index 65e936bb..3c64f80f 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -153,6 +153,7 @@ ? `/send/${subject.username}` : `/${subject.username}/receive`} class="contents" + id="payButton" > <button class="rounded-2xl border py-5 px-6 font-bold hover:opacity-80 flex w-60 grow" diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte index e681c214..0fc26c85 100644 --- a/src/routes/(app)/[username]/(profile)/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/+page.svelte @@ -71,6 +71,11 @@ dragDisabled = false; } + $: if (total > 0 && browser) { + let payButton = document.querySelector("#payButton"); + payButton.addEventListener("click", checkout); + } + let checkout = async () => { let invoice = { type: "lightning", @@ -87,7 +92,7 @@ user: { username: subject.username }, }); - goto(`/send/invoice/${id}`, { invalidateAll: true }); + goto(`/send/invoice/${id}`, { invalidateAll: true }); }; let reset = () => diff --git a/src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte b/src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte index ec35c3fb..13493829 100644 --- a/src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte @@ -115,12 +115,15 @@ <input type="hidden" name="tip" value={tip} /> <input type="hidden" name="username" value={username} /> <input type="hidden" name="rate" value={invoice.rate} /> - <input type="hidden" name="memoPrompt" value={invoice.memoPrompt} /> <input type="hidden" name="prompt" value="false" /> <input type="hidden" name="type" value={type} /> <input type="hidden" name="hash" value={hash} /> <input type="hidden" name="items" value={JSON.stringify(items)} /> + {#if invoice.memoPrompt} + <input type="hidden" name="memoPrompt" value={invoice.memoPrompt} /> + {/if} + <h1 class="text-4xl font-semibold my-8">{$t("invoice.addTipq")}</h1> {#if !showCustomAmount} <div class="my-2 text-xl">{Math.round(tipPercent)}%</div> |
