summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet/History.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-02-14 14:44:27 -0300
committerSebastian <sebasjm@gmail.com>2024-02-14 14:44:27 -0300
commit2303729de608a596509ab41beb1cc2c1637a37a3 (patch)
tree6fe95ffc979885f455ac9527ab95f79ed199f9bf /packages/taler-wallet-webextension/src/wallet/History.tsx
parenta3b8e7120dfeedee0e6b187507035a0650f7ed41 (diff)
downloadwallet-core-2303729de608a596509ab41beb1cc2c1637a37a3.tar.gz
wallet-core-2303729de608a596509ab41beb1cc2c1637a37a3.tar.bz2
wallet-core-2303729de608a596509ab41beb1cc2c1637a37a3.zip
fix #8391
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/History.tsx')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/History.tsx30
1 files changed, 7 insertions, 23 deletions
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<number>(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