From ffb2a1c2ccfeb8d6002644e2fcefe60a7fd20d05 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 11 Mar 2023 16:36:40 -0800 Subject: prompt for tip --- src/components/About.svelte | 2 +- .../(app)/[username]/invoice/[hash]/+layout.server.js | 2 +- src/routes/(app)/send/invoice/[id]/+page.server.js | 2 +- .../(app)/send/user/[username]/[...amount]/+page.svelte | 16 +++++----------- src/routes/(app)/sent/+page.server.js | 2 +- 5 files changed, 9 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/components/About.svelte b/src/components/About.svelte index b468750d..4292b9fd 100644 --- a/src/components/About.svelte +++ b/src/components/About.svelte @@ -12,7 +12,7 @@ { type: 'github', url: 'https://github.com/asoltys', color: 'bg-gray-800' } ] }, - { name: 'cole', socials: [] }, + { name: 'cole', socials: [] } ]; diff --git a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js b/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js index b5323d3f..7cf87e14 100644 --- a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js +++ b/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js @@ -19,7 +19,7 @@ export async function load({ depends, params, url, parent }) { if (paid && !url.pathname.endsWith('paid')) throw redirect(307, `/${params.username}/invoice/${hash}/paid`); - let sm = Qr.drawImg(invoice.text, { size: 300 }); + let sm = Qr.drawImg(invoice.text || '', { size: 300 }); return { hash, invoice, sm, lg: sm }; } diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index 0d23d307..261345fa 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -6,7 +6,7 @@ export async function load({ params: { id }, parent, url }) { let { amount, address, rate, prompt, tip, text, user: recipient } = await get(`/invoice/${id}`); - if (prompt && tip === null) throw redirect(307, `/${recipient.username}/invoice/${id}/tip`); + if (prompt && tip === null) throw redirect(307, `/${recipient.username}/invoice/${id}/tip`); if (recipient.username === user.username) throw error(500, { message: 'Cannot send to self' }); return { amount, address, tip, rate, payreq: text, recipient }; } diff --git a/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte b/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte index 1bb88277..af6a6368 100644 --- a/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte +++ b/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte @@ -30,11 +30,15 @@ ({ hash } = await post(`/${subject.username}/invoice`, { invoice: { amount, + hash: 'internal', rate: rates[subject.currency], + prompt: subject.prompt, type: 'internal' }, user: subject })); + + goto(`/${subject.username}/invoice/${hash}`); }; let loading; @@ -56,17 +60,7 @@ {/if}
- {#if amount} -

Sending

-
-

- {f(amountFiat, currency)} -

-

{sat(amount)}

-
- {:else} - - {/if} +
diff --git a/src/routes/(app)/sent/+page.server.js b/src/routes/(app)/sent/+page.server.js index cfd43472..d949906a 100644 --- a/src/routes/(app)/sent/+page.server.js +++ b/src/routes/(app)/sent/+page.server.js @@ -2,6 +2,6 @@ import { get, auth } from '$lib/utils'; export let load = async ({ cookies }) => { let { payments } = await get('/payments', auth(cookies)); - console.log("HUH", payments[0]) + console.log('HUH', payments[0]); return { payments }; }; -- cgit v1.2.3