From 8b866b1a997f72aa9ab629f9af9390dfad9f1424 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 3 Nov 2022 02:01:55 -0700 Subject: tx labels --- src/lib/utils.js | 1 + src/routes/(app)/[username]/transactions/[...page]/+page.svelte | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/utils.js b/src/lib/utils.js index a2829ca4..70aac87e 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -133,6 +133,7 @@ export const f = (s, currency) => export const s = (s) => new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(s); export const sat = (s) => { + s = Math.abs(s); let p = Math.floor(Math.log(s) / Math.LN10 + 0.000000001); let d = Math.floor((p + 1) / 3); diff --git a/src/routes/(app)/[username]/transactions/[...page]/+page.svelte b/src/routes/(app)/[username]/transactions/[...page]/+page.svelte index efecbaf2..91429917 100644 --- a/src/routes/(app)/[username]/transactions/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/transactions/[...page]/+page.svelte @@ -121,12 +121,19 @@ {#if tx.with}
+
+ {tx.amount > 0 ? 'From' : 'To'} +
-
{tx.with.username}
+
{tx.with.username}
+ {:else} +
+ {tx.amount > 0 ? 'Received' : 'Sent'} +
{/if} -- cgit v1.2.3