From 6a153202729b6a8ecfbe610abaabbc24bf8f94ba Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 12 Apr 2024 12:34:03 -0300 Subject: dd53: Android has different order of items on top --- .../src/wallet/History.tsx | 150 +++++++++++---------- 1 file changed, 82 insertions(+), 68 deletions(-) (limited to 'packages/taler-wallet-webextension') diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx index b27bf3f51..3d1ab15b6 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -20,7 +20,7 @@ import { NotificationType, ScopeType, Transaction, - WalletBalance + WalletBalance, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; @@ -62,14 +62,15 @@ export function HistoryPage({ const [balanceIndex, setBalanceIndex] = useState(0); const [settings] = useSettings(); const state = useAsyncAsHook(async () => { - const b = await api.wallet.call(WalletApiOperation.GetBalances, {}) - const balance = b.balances.length > 0 ? b.balances[balanceIndex] : undefined + const b = await api.wallet.call(WalletApiOperation.GetBalances, {}); + const balance = + b.balances.length > 0 ? b.balances[balanceIndex] : undefined; const tx = await api.wallet.call(WalletApiOperation.GetTransactions, { scopeInfo: balance?.scopeInfo, sort: "descending", includeRefreshes: settings.showRefeshTransactions, - }) - return { b, tx } + }); + return { b, tx }; }, [balanceIndex]); useEffect(() => { @@ -108,7 +109,7 @@ export function HistoryPage({ return ( setBalanceIndex(b)} + changeBalanceIndex={(b) => setBalanceIndex(b)} balances={state.response.b.balances} goToWalletManualWithdraw={goToWalletManualWithdraw} goToWalletDeposit={goToWalletDeposit} @@ -125,7 +126,7 @@ export function HistoryView({ goToWalletManualWithdraw, goToWalletDeposit, }: { - balanceIndex: number, + balanceIndex: number; changeBalanceIndex: (s: number) => void; goToWalletDeposit: (currency: string) => Promise; goToWalletManualWithdraw: (currency?: string) => Promise; @@ -141,86 +142,45 @@ export function HistoryView({ : undefined; const datesWithTransaction: string[] = []; - const byDate = transactions.reduce((rv, x) => { - const startDay = - x.timestamp.t_s === "never" ? 0 : startOfDay(x.timestamp.t_s * 1000).getTime(); - if (startDay) { - if (!rv[startDay]) { - rv[startDay] = []; - datesWithTransaction.push(String(startDay)); + const byDate = transactions.reduce( + (rv, x) => { + const startDay = + x.timestamp.t_s === "never" + ? 0 + : startOfDay(x.timestamp.t_s * 1000).getTime(); + if (startDay) { + if (!rv[startDay]) { + rv[startDay] = []; + datesWithTransaction.push(String(startDay)); + } + rv[startDay].push(x); } - rv[startDay].push(x); - } - return rv; - }, {} as { [x: string]: Transaction[] }); + return rv; + }, + {} as { [x: string]: Transaction[] }, + ); return (
- - Balance -
-
- {balances.length === 1 ? ( - - {balance.scopeInfo.currency} - - ) : ( - - -
- {balance.scopeInfo.type === ScopeType.Exchange || balance.scopeInfo.type === ScopeType.Auditor ? balance.scopeInfo.url : undefined} -
-
- )} - {available && ( - - {Amounts.stringifyValue(available, 2)} - - )} -
@@ -236,6 +196,60 @@ export function HistoryView({ )}
+
+

Balance

+
+ {balances.length === 1 ? ( + + {balance.scopeInfo.currency} + + ) : ( + + +
+ {balance.scopeInfo.type === ScopeType.Exchange || + balance.scopeInfo.type === ScopeType.Auditor + ? balance.scopeInfo.url + : undefined} +
+
+ )} + {available && ( + + {Amounts.stringifyValue(available, 2)} + + )} +
+
{datesWithTransaction.length === 0 ? ( -- cgit v1.2.3