summaryrefslogtreecommitdiff
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
parenta3b8e7120dfeedee0e6b187507035a0650f7ed41 (diff)
downloadwallet-core-2303729de608a596509ab41beb1cc2c1637a37a3.tar.gz
wallet-core-2303729de608a596509ab41beb1cc2c1637a37a3.tar.bz2
wallet-core-2303729de608a596509ab41beb1cc2c1637a37a3.zip
fix #8391
-rw-r--r--packages/taler-wallet-webextension/src/hooks/useSettings.ts1
-rw-r--r--packages/taler-wallet-webextension/src/platform/api.ts2
-rw-r--r--packages/taler-wallet-webextension/src/wallet/History.tsx30
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Settings.tsx4
4 files changed, 14 insertions, 23 deletions
diff --git a/packages/taler-wallet-webextension/src/hooks/useSettings.ts b/packages/taler-wallet-webextension/src/hooks/useSettings.ts
index dd3822c1a..29449cd59 100644
--- a/packages/taler-wallet-webextension/src/hooks/useSettings.ts
+++ b/packages/taler-wallet-webextension/src/hooks/useSettings.ts
@@ -42,6 +42,7 @@ export const codecForSettings = (): Codec<Settings> =>
.property("showJsonOnError", codecForBoolean())
.property("extendedAccountTypes", codecForBoolean())
.property("suspendIndividualTransaction", codecForBoolean())
+ .property("showRefeshTransactions", codecForBoolean())
.build("Settings");
const SETTINGS_KEY = buildStorageKey("wallet-settings", codecForSettings());
diff --git a/packages/taler-wallet-webextension/src/platform/api.ts b/packages/taler-wallet-webextension/src/platform/api.ts
index c7d297db9..5bc7fd6c5 100644
--- a/packages/taler-wallet-webextension/src/platform/api.ts
+++ b/packages/taler-wallet-webextension/src/platform/api.ts
@@ -118,6 +118,7 @@ export interface Settings extends WebexWalletConfig {
langSelector: boolean;
showJsonOnError: boolean;
extendedAccountTypes: boolean;
+ showRefeshTransactions: boolean;
suspendIndividualTransaction: boolean;
}
@@ -127,6 +128,7 @@ export const defaultSettings: Settings = {
advanceMode: false,
backup: false,
langSelector: false,
+ showRefeshTransactions: false,
suspendIndividualTransaction: false,
showJsonOnError: false,
extendedAccountTypes: false,
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
diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.tsx b/packages/taler-wallet-webextension/src/wallet/Settings.tsx
index e25629148..03e4dc64a 100644
--- a/packages/taler-wallet-webextension/src/wallet/Settings.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Settings.tsx
@@ -311,6 +311,10 @@ function AdvanceSettings(): VNode {
label: i18n.str`Show suspend/resume transaction`,
description: i18n.str`Prevent transaction from doing network request.`,
},
+ showRefeshTransactions: {
+ label: i18n.str`Show refresh transaction type in the transaction list`,
+ description: i18n.str`Refresh transaction will be hidden by default if the refresh operation doesn't have fee.`,
+ },
extendedAccountTypes: {
label: i18n.str`Show more account types on deposit`,
description: i18n.str`Extends the UI to more payment target types.`,