From 20907508a3703a8793265e13151b8daad6b4106e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 23 Feb 2024 21:31:57 -0800 Subject: tips total --- src/locales/en.json | 1 + .../[username]/payments/[...page]/+page.svelte | 41 +++++++++++++--------- 2 files changed, 26 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/locales/en.json b/src/locales/en.json index 4b18bd64..1500e9ef 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -291,6 +291,7 @@ } }, "payments": { + "tips": "Tips", "options": "options", "bump": "Bump fee", "networkFee": "Network fee", diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.svelte b/src/routes/(app)/[username]/payments/[...page]/+page.svelte index dfe5b83c..90f2ddbc 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/payments/[...page]/+page.svelte @@ -249,22 +249,31 @@ {/each} - - - - - - - - - - - - - - - - +
+ {$t("payments.total")} + + {#if payments.some((p) => p.tip > 0)} + {$t("payments.tips")} + {/if} + + + + {#each Object.keys(totals) as c} + {@const total = totals[c]["fiat"]} + {@const tips = totals[c]["fiatTips"]} + {@const pv = (totals[c]["sats"] * rates[c]) / sats} + {@const gain = (pv * 100) / total - 100} + {f(total, c)} + + + {#if payments.some((p) => p.tip > 0)} + {f(tips, c)} + {/if} + + + + {/each} +