From 2303729de608a596509ab41beb1cc2c1637a37a3 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 14 Feb 2024 14:44:27 -0300 Subject: fix #8391 --- .../src/wallet/History.tsx | 30 +++++----------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet/History.tsx') diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx index 1cf7021d5..fed446cad 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -18,13 +18,13 @@ import { AbsoluteTime, Amounts, NotificationType, - ScopeInfo, 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"; +import { startOfDay } from "date-fns"; import { Fragment, VNode, h } from "preact"; import { useEffect, useState } from "preact/hooks"; import { ErrorAlertView } from "../components/CurrentAlerts.js"; @@ -40,11 +40,11 @@ import { import { alertFromError, useAlertContext } from "../context/alert.js"; import { useBackendContext } from "../context/backend.js"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js"; +import { useSettings } from "../hooks/useSettings.js"; import { Button } from "../mui/Button.js"; import { NoBalanceHelp } from "../popup/NoBalanceHelp.js"; import DownloadIcon from "../svg/download_24px.inline.svg"; import UploadIcon from "../svg/upload_24px.inline.svg"; -import { getDate, startOfDay } from "date-fns"; interface Props { currency?: string; @@ -59,12 +59,14 @@ export function HistoryPage({ const { i18n } = useTranslationContext(); const api = useBackendContext(); 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 tx = await api.wallet.call(WalletApiOperation.GetTransactions, { - scopeInfo: balance?.scopeInfo + scopeInfo: balance?.scopeInfo, + sort: "descending", + includeRefreshes: settings.showRefeshTransactions, }) return { b, tx } }, [balanceIndex]); @@ -130,24 +132,6 @@ export function HistoryView({ }): VNode { const { i18n } = useTranslationContext(); - // const currencies = balances - // .filter((b) => { - // const av = Amounts.parseOrThrow(b.available); - // return ( - // Amounts.isNonZero(av) || - // (transactionByCurrency[av.currency] && - // transactionByCurrency[av.currency].length > 0) - // ); - // }); - - // const defaultCurrencyIndex = balances.findIndex( - // (c) => c.scopeInfo.currency === defaultCurrency, - // ); - // const [currencyIndex, setCurrencyIndex] = useState( - // defaultCurrencyIndex === -1 ? 0 : defaultCurrencyIndex, - // ); - // const selectedCurrency = - // balances.length > 0 ? balances[currencyIndex] : undefined; const balance = balances[balanceIndex]; const available = balance -- cgit v1.2.3