[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: if there is not tx and no mon
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: if there is not tx and no money left, then hide the currency |
Date: |
Sat, 21 Jan 2023 16:32:40 +0100 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 88dbd80f8 if there is not tx and no money left, then hide the currency
88dbd80f8 is described below
commit 88dbd80f8595ede7f2368d5fe447faca7dc6ce77
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Sat Jan 21 12:32:32 2023 -0300
if there is not tx and no money left, then hide the currency
---
.../src/cta/Refund/views.tsx | 4 +-
.../src/wallet/History.tsx | 44 +++++++++++++++-------
2 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/packages/taler-wallet-webextension/src/cta/Refund/views.tsx
b/packages/taler-wallet-webextension/src/cta/Refund/views.tsx
index 16e1c519c..22d49caf4 100644
--- a/packages/taler-wallet-webextension/src/cta/Refund/views.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Refund/views.tsx
@@ -114,7 +114,7 @@ export function ReadyView(state: State.Ready): VNode {
)}
<Part
big
- title={i18n.str`Refund offered`}
+ title={i18n.str`Refund offered (without fee)`}
text={<Amount value={state.awaitingAmount} />}
kind="positive"
/>
@@ -131,7 +131,7 @@ export function ReadyView(state: State.Ready): VNode {
onClick={state.accept.onClick}
>
<i18n.Translate>
- Accept <Amount value={state.amount} />
+ Accept <Amount value={state.awaitingAmount} />
</i18n.Translate>
</Button>
</section>
diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx
b/packages/taler-wallet-webextension/src/wallet/History.tsx
index f2a239f83..e0e2d3af9 100644
--- a/packages/taler-wallet-webextension/src/wallet/History.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/History.tsx
@@ -112,8 +112,25 @@ export function HistoryView({
}): VNode {
const { i18n } = useTranslationContext();
const { pushAlertOnError } = useAlertContext();
+
+ const transactionByCurrency = transactions.reduce((prev, cur) => {
+ const c = Amounts.parseOrThrow(cur.amountEffective).currency;
+ if (!prev[c]) {
+ prev[c] = [];
+ }
+ prev[c].push(cur);
+ return prev;
+ }, {} as Record<string, Transaction[]>);
+
const currencies = balances
- .filter((b) => Amounts.isNonZero(b.available))
+ .filter((b) => {
+ const av = Amounts.parseOrThrow(b.available);
+ return (
+ Amounts.isNonZero(av) ||
+ (transactionByCurrency[av.currency] &&
+ transactionByCurrency[av.currency].length > 0)
+ );
+ })
.map((b) => b.available.split(":")[0]);
const defaultCurrencyIndex = currencies.findIndex(
@@ -129,19 +146,20 @@ export function HistoryView({
? Amounts.jsonifyAmount(balances[currencyIndex].available)
: undefined;
- const byDate = transactions
- .filter((t) => t.amountRaw.split(":")[0] === selectedCurrency)
- .reduce((rv, x) => {
- const theDate =
- x.timestamp.t_s === "never"
- ? 0
- : normalizeToDay(x.timestamp.t_s * 1000);
- if (theDate) {
- (rv[theDate] = rv[theDate] || []).push(x);
- }
+ const ts =
+ selectedCurrency === undefined
+ ? []
+ : transactionByCurrency[selectedCurrency] ?? [];
+
+ const byDate = ts.reduce((rv, x) => {
+ const theDate =
+ x.timestamp.t_s === "never" ? 0 : normalizeToDay(x.timestamp.t_s * 1000);
+ if (theDate) {
+ (rv[theDate] = rv[theDate] || []).push(x);
+ }
- return rv;
- }, {} as { [x: string]: Transaction[] });
+ return rv;
+ }, {} as { [x: string]: Transaction[] });
const datesWithTransaction = Object.keys(byDate);
if (balances.length === 0 || !selectedCurrency) {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: if there is not tx and no money left, then hide the currency,
gnunet <=