diff options
Diffstat (limited to 'src')
7 files changed, 22 insertions, 25 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte index 66488992..f0ab743a 100644 --- a/src/routes/(app)/[username]/(profile)/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/+page.svelte @@ -92,7 +92,11 @@ user: { username: subject.username }, }); - goto(`/send/invoice/${id}`, { invalidateAll: true }); + if (invoice.memoPrompt) { + return goto(`/${subject.username}/invoice/${id}/memo`); + } + if (user) goto(`/send/invoice/${id}`, { invalidateAll: true }); + else goto(`/${subject.username}/invoice/${id}`); }; let reset = () => @@ -144,20 +148,18 @@ </button> </a> - {#if user?.username === subject.username && user.menu} - <a href={`/${user.username}/items/create`} class="contents"> - <button - class="rounded-2xl border py-5 px-6 font-bold hover:opacity-80 flex bg-primary grow basis-full" - > - <div class="mx-auto flex gap-2"> - <Icon icon="plus" style="w-8 mx-auto" /> - <div class="my-auto text-xl whitespace-nowrap"> - {$t("items.add")} - </div> + <a href={`/${user.username}/items/create`} class="contents"> + <button + class="rounded-2xl border py-5 px-6 font-bold hover:opacity-80 flex bg-primary grow basis-full" + > + <div class="mx-auto flex gap-2"> + <Icon icon="plus" style="w-8 mx-auto" /> + <div class="my-auto text-xl whitespace-nowrap"> + {$t("items.add")} </div> - </button> - </a> - {/if} + </div> + </button> + </a> </div> {/if} diff --git a/src/routes/(app)/[username]/invoice/[id]/+layout.server.js b/src/routes/(app)/[username]/invoice/[id]/+layout.server.js index 0df10cca..c9920052 100644 --- a/src/routes/(app)/[username]/invoice/[id]/+layout.server.js +++ b/src/routes/(app)/[username]/invoice/[id]/+layout.server.js @@ -34,5 +34,6 @@ export async function load({ depends, params, url, parent }) { } let src = Qr.drawImg(invoice.text || "", { size: 340 }); + return { id, invoice, src }; } diff --git a/src/routes/(app)/[username]/invoice/[id]/+page.svelte b/src/routes/(app)/[username]/invoice/[id]/+page.svelte index a7ffbff3..d2a54425 100644 --- a/src/routes/(app)/[username]/invoice/[id]/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[id]/+page.svelte @@ -1,5 +1,5 @@ <script> - import { enhance } from "$app/forms"; + import { enhance } from "$app/forms"; import { send } from "$lib/socket"; import { btc, @@ -42,10 +42,7 @@ amount, hash, type, - memoPrompt, rate, - received, - prompt, text, tip, user: { username, currency }, @@ -61,8 +58,6 @@ hash, type, rate, - received, - prompt, text, tip, user: { username, currency }, diff --git a/src/routes/(app)/[username]/invoice/[id]/memo/+page.server.js b/src/routes/(app)/[username]/invoice/[id]/memo/+page.server.js index b81e2364..58d56018 100644 --- a/src/routes/(app)/[username]/invoice/[id]/memo/+page.server.js +++ b/src/routes/(app)/[username]/invoice/[id]/memo/+page.server.js @@ -3,8 +3,9 @@ import { redirect } from "@sveltejs/kit"; export async function load({ parent, params }) { let { invoice } = await parent(); - if (!invoice.amount) + if (!invoice.amount) { redirect(307, `/${params.username}/invoice/${invoice.id}`); + } } export const actions = { diff --git a/src/routes/(app)/[username]/invoice/[id]/memo/+page.svelte b/src/routes/(app)/[username]/invoice/[id]/memo/+page.svelte index ddc60d1e..4d23ff19 100644 --- a/src/routes/(app)/[username]/invoice/[id]/memo/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[id]/memo/+page.svelte @@ -13,10 +13,8 @@ sats, } from "$lib/utils"; import Icon from "$comp/Icon.svelte"; - import { goto } from "$app/navigation"; import { t } from "$lib/translations"; import { enhance } from "$app/forms"; - import { tick } from "svelte"; let submitting; let submit; diff --git a/src/routes/(app)/send/+layout.svelte b/src/routes/(app)/send/+layout.svelte index 5e379c32..9e14fa39 100644 --- a/src/routes/(app)/send/+layout.svelte +++ b/src/routes/(app)/send/+layout.svelte @@ -9,7 +9,7 @@ let cancel = () => goto(`/${user.username}`); </script> -{#if user.haspin && (!$pin || $pin?.length !== 6)} +{#if user?.haspin && (!$pin || $pin?.length !== 6)} <Pin bind:value={$pin} {cancel} /> {/if} diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index 2cb19b80..e3c6ba74 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -12,7 +12,7 @@ export async function load({ params: { id }, parent, url }) { if (invoice.memoPrompt && invoice.memo === null) redirect(307, `/${invoice.user.username}/invoice/${id}/memo`); - if (invoice.user.username === user.username) + if (invoice.user.username === user?.username) error(500, { message: "Cannot send to self" }); return { invoice, rates, user }; |
