From 0bf630c39fe290ea2718eab7a0759d978c736ef9 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Nov 2024 13:08:08 -0800 Subject: bip21 and socket fixes --- .../(app)/payments/[...page]/+page.server.ts | 2 +- src/routes/(app)/payments/[...page]/+page.svelte | 186 ++++++++++----------- 2 files changed, 90 insertions(+), 98 deletions(-) (limited to 'src/routes/(app)/payments') diff --git a/src/routes/(app)/payments/[...page]/+page.server.ts b/src/routes/(app)/payments/[...page]/+page.server.ts index 268fd32b..05ed2d64 100644 --- a/src/routes/(app)/payments/[...page]/+page.server.ts +++ b/src/routes/(app)/payments/[...page]/+page.server.ts @@ -1,4 +1,4 @@ -import { get, auth } from "$lib/utils"; +import { auth, get } from "$lib/utils"; const limit = 25; diff --git a/src/routes/(app)/payments/[...page]/+page.svelte b/src/routes/(app)/payments/[...page]/+page.svelte index cda7c350..146a286d 100644 --- a/src/routes/(app)/payments/[...page]/+page.svelte +++ b/src/routes/(app)/payments/[...page]/+page.svelte @@ -11,8 +11,9 @@ import { goto, invalidate } from "$app/navigation"; import locales from "$lib/locales"; let { data } = $props(); + let { start, end, user, rates, payments, incoming, outgoing } = + $derived(data); - let { start, end, user, rates, payments } = $state(data); let locale = locales[user.language]; let change = ({ target: { value } }) => goto(value); @@ -55,19 +56,13 @@ ); let p = $state(), - incoming = $state(), - outgoing = $state(), pages = $state([]); - run(() => { - data && - ({ page: p, pages, start, end, incoming, outgoing, payments } = data); - }); - run(() => { - $page && ($newPayment = false); - }); - run(() => { - $newPayment && invalidate(`/users/${user.username}`); + $effect(() => { + if ($newPayment) { + $newPayment = false; + invalidate(`/users/${user.username}`); + } }); let path = $derived( @@ -204,104 +199,101 @@
{#each payments as p, i} -
goto(`/payment/${p.id}`)} - > -
-
-
- -
{s(Math.abs(p.amount))}
-
+
goto(`/payment/${p.id}`)} + > +
+
+
+ +
{s(Math.abs(p.amount))}
+
-
- {f(Math.abs(p.amount) * (p.rate / sats), p.currency)} +
+ {f(Math.abs(p.amount) * (p.rate / sats), p.currency)} - {#if p.tip} - -  +{Math.round((p.tip / Math.abs(p.amount)) * 100)}% - - {/if} -
+ {#if p.tip} + +  +{Math.round((p.tip / Math.abs(p.amount)) * 100)}% + + {/if}
+
-
- {#if p.type === types.pot} - -
-
- Pot -
- -
Pot
-
-
- {:else if p.with} -
-
- -
-
- {p.with.username} +
+ {#if p.type === types.pot} + +
+
+ Pot
-
- {:else} -
- {#if p.type === types.lightning} - - {:else if p.type === types.ecash} - - {:else if p.type === types.reconcile} - - {:else if p.type === types.bitcoin} - - {:else if p.type === types.liquid} -
- Liquid -
- {/if} +
Pot
+
+
+ {:else if p.with} +
+
+ +
+
+ {p.with.username} +
+
+ {:else} +
+ {#if p.type === types.lightning} + + {:else if p.type === types.ecash} + + {:else if p.type === types.reconcile} + + {:else if p.type === types.bitcoin} + + {:else if p.type === types.liquid}
- {p.amount > 0 - ? p.confirmed - ? "Received" - : "Pending" - : "Sent"} + Liquid
-
- {/if} -
+ {/if} -
-
- {format(new Date(p.created), "h:mm aaa", { locale })} -
-
- {format(new Date(p.created), "MMM d, yy", { locale })} +
+ {p.amount > 0 + ? p.confirmed + ? "Received" + : "Pending" + : "Sent"} +
+ {/if} +
+ +
+
+ {format(new Date(p.created), "h:mm aaa", { locale })} +
+
+ {format(new Date(p.created), "MMM d, yy", { locale })}
+
{:else}

{$t("payments.empty")}

{/each} -- cgit v1.2.3