diff options
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/+page.server.ts | 9 | ||||
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/+page.svelte | 25 |
2 files changed, 25 insertions, 9 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+page.server.ts b/src/routes/(app)/[username]/(profile)/+page.server.ts index 7d54592b..a7fb4f19 100644 --- a/src/routes/(app)/[username]/(profile)/+page.server.ts +++ b/src/routes/(app)/[username]/(profile)/+page.server.ts @@ -1,16 +1,11 @@ import { auth, get } from "$lib/utils"; -export async function load({ cookies, depends, parent }) { +export async function load({ cookies, depends }) { depends("app:payments"); depends("app:items"); - const { subject } = await parent(); - let accounts = []; if (cookies.get("token")) accounts = await get("/accounts", auth(cookies)); - const items = await get(`/${subject.id}/items`, auth(cookies)); - items.map((i) => (i.quantity = 0)); - - return { accounts, items }; + return { accounts }; } diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte index b2c1970a..eb21a45c 100644 --- a/src/routes/(app)/[username]/(profile)/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/+page.svelte @@ -14,10 +14,9 @@ preloadData("/send"); }); - let { accounts, subject, user, items, rates } = $state(data); + let { accounts, subject, user, rates } = $state(data); let { currency } = $derived(subject); let rate = $derived(rates[currency]); - let total = $derived(items.reduce((a, b) => a + b.price * b.quantity, 0)); let install = async () => { if (!$installPrompt) return; @@ -51,3 +50,25 @@ {/if} {/if} </div> + +<div class="fixed inset-x-0 mx-auto flex bottom-16 px-4"> + {#if user?.username !== subject.username && (!subject.anon || subject.lud16)} + <a + href={subject.anon + ? `/send/${encodeURIComponent(subject.lud16)}` + : `/pay/${subject.username}`} + class="contents" + > + <button + class="btn btn-accent !text-2xl items-center !w-full sm:!max-w-[400px] mx-auto" + > + <iconify-icon icon="ph:lightning-fill" class="text-yellow-300" + ></iconify-icon> + <div> + {$t("user.pay")} + {subject.username} + </div> + </button> + </a> + {/if} +</div> |
