From 46898aef5f6e238dbfe1b54cf1cf99a276b7d114 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 29 Feb 2024 01:24:49 -0300 Subject: wip wallet activity --- .../src/wallet/Application.tsx | 5 ++- .../src/wallet/DeveloperPage.tsx | 48 +++++----------------- 2 files changed, 15 insertions(+), 38 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet') diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx b/packages/taler-wallet-webextension/src/wallet/Application.tsx index 4fafc73ad..62a519f06 100644 --- a/packages/taler-wallet-webextension/src/wallet/Application.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx @@ -82,6 +82,7 @@ import { SettingsPage } from "./Settings.js"; import { TransactionPage } from "./Transaction.js"; import { WelcomePage } from "./Welcome.js"; import { WalletActivity } from "../components/WalletActivity.js"; +import { EnabledBySettings } from "../components/EnabledBySettings.js"; export function Application(): VNode { const { i18n } = useTranslationContext(); @@ -511,6 +512,9 @@ export function Application(): VNode { component={() => } /> + + + ); @@ -610,7 +614,6 @@ function WalletTemplate({ {children} - ); } diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx index adb114862..cdd3994d7 100644 --- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx @@ -46,6 +46,7 @@ import { Paper } from "../mui/Paper.js"; import { TextField } from "../mui/TextField.js"; import { Pages } from "../NavigationBar.js"; import { CoinInfo } from "@gnu-taler/taler-wallet-core/dbless"; +import { ActiveTasksTable } from "../components/WalletActivity.js"; type CoinsInfo = CoinDumpJson["coins"]; type CalculatedCoinfInfo = { @@ -95,27 +96,23 @@ export function DeveloperPage({ }: Props): VNode { const [settings, updateSettings] = useSettings(); const { safely } = useAlertContext(); - // const hook = useAsyncAsHook(() => - // api.wallet.call(WalletApiOperation.ListExchanges, {}), - // ); const listenAllEvents = Array.from({ length: 1 }); + listenAllEvents.includes = () => true const hook = useAsyncAsHook(async () => { const list = await api.wallet.call(WalletApiOperation.ListExchanges, {}); const version = await api.wallet.call(WalletApiOperation.GetVersion, {}); - const tasks = await api.wallet.call( - WalletApiOperation.GetActiveTasks, - {}, - ); const coins = await api.wallet.call(WalletApiOperation.DumpCoins, {}); - return { exchanges: list.exchanges, version, coins, tasks:tasks.tasks }; + return { exchanges: list.exchanges, version, coins }; }); const exchangeList = hook && !hook.hasError ? hook.response.exchanges : []; const coins = hook && !hook.hasError ? hook.response.coins.coins : []; - const tasks = hook && !hook.hasError ? hook.response.tasks : []; useEffect(() => { - return api.listener.onUpdateNotification(listenAllEvents, hook?.retry); + return api.listener.onUpdateNotification(listenAllEvents, (ev) => { + console.log("event", ev) + return hook?.retry() + }); }); const currencies: { [ex: string]: string } = {}; @@ -145,7 +142,6 @@ export function DeveloperPage({ }: Props): VNode { ); const [tagName, setTagName] = useState(""); - const [exchangeURL, setExchangeURL] = useState(""); const [logLevel, setLogLevel] = useState("info"); return (
@@ -322,7 +318,7 @@ export function DeveloperPage({ }: Props): VNode { return ( - + {e.scopeInfo ? `${e.scopeInfo.currency} (${e.scopeInfo.type === ScopeType.Global ? "global" : "regional"})` : e.currency} @@ -545,31 +541,9 @@ export function DeveloperPage({ }: Props): VNode { ); })}
- {tasks && tasks.length > 0 && ( - -

- Pending operations -

-
- {tasks.map((o) => { - return ( - -
- {o.id}{" "} -
-
-
{JSON.stringify(o, undefined, 2)}
-
-
- ); - })} -
-
- )} + + +
); } -- cgit v1.2.3