diff options
| author | Adam Soltys <[email protected]> | 2025-01-03 15:24:31 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-01-03 15:24:31 -0800 |
| commit | 50296ccde06dc7892b0c6bd1546030f495564b28 (patch) | |
| tree | 444e26008235c9a57ec2756d8b8fa60133d4e4a9 /src/routes/(app) | |
| parent | 1bfdc18184fd57b741f5ebdfb0e323747f4d06b0 (diff) | |
| download | coinos-ui-50296ccde06dc7892b0c6bd1546030f495564b28.tar.gz coinos-ui-50296ccde06dc7892b0c6bd1546030f495564b28.zip | |
nostr sign in
Diffstat (limited to 'src/routes/(app)')
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/+page.svelte | 15 | ||||
| -rw-r--r-- | src/routes/(app)/events/+server.ts | 8 | ||||
| -rw-r--r-- | src/routes/(app)/invoice/[id]/paid/+page.svelte | 11 | ||||
| -rw-r--r-- | src/routes/(app)/ln/[lnurl]/+page.server.ts | 2 | ||||
| -rw-r--r-- | src/routes/(app)/pay/[username]/[...amount]/+page.server.ts | 6 | ||||
| -rw-r--r-- | src/routes/(app)/send/invoice/[id]/+page.server.ts | 4 |
6 files changed, 32 insertions, 14 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte index a498f0f7..6530f149 100644 --- a/src/routes/(app)/[username]/(profile)/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/+page.svelte @@ -8,6 +8,7 @@ import { t } from "$lib/translations"; import { installPrompt } from "$lib/store"; import { afterNavigate, preloadData } from "$app/navigation"; + import { page } from "$app/stores"; let { data } = $props(); @@ -24,7 +25,9 @@ $installPrompt = null; }; + let pubkey = $state(); if (user) user.savings = 0; + let { host } = $derived($page.url); </script> <div class="space-y-2"> @@ -37,14 +40,16 @@ <a href={`/account/savings`} class="contents"> <button class="btn btn-lg w-full rounded-2xl whitespace-nowrap"> - <iconify-icon noobserver icon="ph:plus-circle-bold" width="32"></iconify-icon> + <iconify-icon noobserver icon="ph:plus-circle-bold" width="32" + ></iconify-icon> {$t("accounts.addAccount")} </button> </a> {#if $installPrompt} <button class="btn btn-accent lg:hidden" onclick={install}> - <iconify-icon noobserver icon="ph:floppy-disk-bold" width="32"></iconify-icon> + <iconify-icon noobserver icon="ph:floppy-disk-bold" width="32" + ></iconify-icon> {$t("user.install")} </button> {/if} @@ -62,7 +67,10 @@ <button class="btn btn-accent !text-2xl items-center !w-full sm:!max-w-[400px] mx-auto" > - <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" + <iconify-icon + noobserver + icon="ph:lightning-fill" + class="text-yellow-300" ></iconify-icon> <div> {$t("user.pay")} @@ -72,3 +80,4 @@ </a> {/if} </div> + diff --git a/src/routes/(app)/events/+server.ts b/src/routes/(app)/events/+server.ts index 42b9f3dd..59fc472e 100644 --- a/src/routes/(app)/events/+server.ts +++ b/src/routes/(app)/events/+server.ts @@ -1,5 +1,11 @@ import { auth, post } from "$lib/utils"; -import { json, error } from "@sveltejs/kit"; +import { error, json } from "@sveltejs/kit"; + +export async function GET({ url }) { + console.log(url.searchParams.get("event")); + console.log(url.searchParams.get("uid")); + return json({}); +} export async function POST({ cookies, request }) { const body = await request.json(); diff --git a/src/routes/(app)/invoice/[id]/paid/+page.svelte b/src/routes/(app)/invoice/[id]/paid/+page.svelte index a13692d7..bc61d7fe 100644 --- a/src/routes/(app)/invoice/[id]/paid/+page.svelte +++ b/src/routes/(app)/invoice/[id]/paid/+page.svelte @@ -2,29 +2,36 @@ import Amount from "$comp/Amount.svelte"; import Success from "$comp/Success.svelte"; import { t } from "$lib/translations"; + import { loc } from "$lib/utils"; let { data } = $props(); let { amount, currency, rate, received, pending, tip, user, id } = $derived( data.invoice, ); + let locale = $derived(loc(user)); // toast.pop(0); </script> <div class="container px-4 text-center mx-auto"> {#if pending} - <iconify-icon noobserver icon="ph:clock-bold" class="text-warning" width="160" + <iconify-icon + noobserver + icon="ph:clock-bold" + class="text-warning" + width="160" ></iconify-icon> <h1 class="text-3xl md:text-4xl font-bold mb-6">Payment detected</h1> - <Amount amount={pending - tip} {tip} {rate} {currency} /> + <Amount amount={pending - tip} {tip} {rate} {currency} {locale} /> {:else} <Success amount={received - tip} {rate} {tip} {currency} + {locale} title={$t("invoice.paymentSuccessful")} /> {/if} diff --git a/src/routes/(app)/ln/[lnurl]/+page.server.ts b/src/routes/(app)/ln/[lnurl]/+page.server.ts index 53445461..7b63e6f5 100644 --- a/src/routes/(app)/ln/[lnurl]/+page.server.ts +++ b/src/routes/(app)/ln/[lnurl]/+page.server.ts @@ -7,12 +7,10 @@ export async function load({ params, parent }) { if (!user) redirect(307, "/register"); const rates = await getRates(); - console.log("YO"); let data; try { const { lnurl } = params; data = await get(`/decode?text=${lnurl}`); - console.log("DATA", data); } catch (e) { const { message } = e as Error; error(500, message); diff --git a/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts b/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts index 812b97ec..b0f824ed 100644 --- a/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts +++ b/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts @@ -45,11 +45,8 @@ export const actions = { default: async ({ cookies, request }) => { let id; const body = await fd(request); - console.log("BODY", body); const { amount, rate, prompt, type, username } = body; - console.log("AMT", amount); - try { ({ id } = await post( "/invoice", @@ -69,7 +66,8 @@ export const actions = { return fail(400, { message }); } - if (prompt) redirect(307, `/invoice/${id}/tip`); + if (parseInt(amount) > 0 && prompt) redirect(307, `/invoice/${id}/tip`); + else if (parseInt(amount) <= 0 ) redirect(307, `/${username}/receive`); redirect(307, `/invoice/${id}`); }, }; diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.ts b/src/routes/(app)/send/invoice/[id]/+page.server.ts index 9b971f2f..658629ef 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.ts +++ b/src/routes/(app)/send/invoice/[id]/+page.server.ts @@ -8,7 +8,7 @@ export async function load({ cookies, params: { id }, parent }) { const invoice = await get(`/invoice/${id}`); - if (invoice.prompt && invoice.tip === null) + if (invoice.amount && invoice.prompt && invoice.tip === null) redirect(307, `/invoice/${id}/tip`); if (invoice.memoPrompt && invoice.memo === null) @@ -17,7 +17,7 @@ export async function load({ cookies, params: { id }, parent }) { if (user && invoice.aid === aid) error(500, { message: "Cannot send to self" }); else if (user && ![types.lightning, types.bolt12].includes(invoice.type)) - redirect(307, `/send/${invoice.type}/${invoice.hash}`); + redirect(307, `/send/${invoice.type === types.ecash ? "ecash" : "bitcoin"}/${invoice.hash}`); if (!user) redirect(307, `/invoice/${id}`); |
