From eb1500e517d475aad22cfe02c8a5c5c6acefe00a Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 19 Feb 2024 18:42:33 +0100 Subject: get rid of deprecated/unused types --- .../src/wallet/DeveloperPage.stories.tsx | 7 +- .../src/wallet/DeveloperPage.tsx | 187 ++++++++++----------- 2 files changed, 92 insertions(+), 102 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet') diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.stories.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.stories.tsx index 2ca5305f5..c2c794e89 100644 --- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.stories.tsx @@ -19,10 +19,9 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { PendingTaskType, TaskId } from "@gnu-taler/taler-wallet-core"; +import { AbsoluteTime } from "@gnu-taler/taler-util"; import * as tests from "@gnu-taler/web-util/testing"; import { View as TestedComponent } from "./DeveloperPage.js"; -import { AbsoluteTime, PendingIdStr } from "@gnu-taler/taler-util"; export default { title: "developer", @@ -36,8 +35,8 @@ export const AllOff = tests.createExample(TestedComponent, { onDownloadDatabase: async () => "this is the content of the database", operations: [ { - id: " " as TaskId, - type: PendingTaskType.ExchangeUpdate, + id: " ", + type: "exchange-update", exchangeBaseUrl: "http://exchange.url.", givesLifeness: false, lastError: undefined, diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx index 5230d830f..0db7a07eb 100644 --- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx @@ -23,26 +23,23 @@ import { LogLevel, NotificationType, } from "@gnu-taler/taler-util"; -import { - PendingTaskInfo, - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { format } from "date-fns"; import { Fragment, VNode, h } from "preact"; import { useEffect, useRef, useState } from "preact/hooks"; +import { Checkbox } from "../components/Checkbox.js"; import { SelectList } from "../components/SelectList.js"; import { Time } from "../components/Time.js"; import { NotifyUpdateFadeOut } from "../components/styled/index.js"; +import { 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 { Grid } from "../mui/Grid.js"; import { Paper } from "../mui/Paper.js"; import { TextField } from "../mui/TextField.js"; -import { Checkbox } from "../components/Checkbox.js"; -import { useSettings } from "../hooks/useSettings.js"; -import { useAlertContext } from "../context/alert.js"; export function DeveloperPage(): VNode { const listenAllEvents = Array.from({ length: 1 }); @@ -105,7 +102,8 @@ type SplitedCoinInfo = { }; export interface Props { - operations: PendingTaskInfo[]; + // FIXME: Pending operations don't exist anymore. + operations: any[]; coins: CoinsInfo; exchanges: ExchangeListItem[]; onDownloadDatabase: () => Promise; @@ -351,8 +349,8 @@ export function View({ operations, coins, onDownloadDatabase }: Props): VNode { name="inject" description={ - Enabling this option will make `window.taler` be available - in all sites + Enabling this option will make `window.taler` be available in all + sites } enabled={settings.injectTalerSupport!} @@ -361,7 +359,6 @@ export function View({ operations, coins, onDownloadDatabase }: Props): VNode { })} /> -

Logging

@@ -414,8 +411,8 @@ export function View({ operations, coins, onDownloadDatabase }: Props): VNode { - { - downloadedDatabase && ( -
- - Database exported at{" "} - -
- ) - } + {downloadedDatabase && ( +
+ + Database exported at{" "} + +
+ )}

Coins:

- { - Object.keys(money_by_exchange).map((ex, idx) => { - const allcoins = money_by_exchange[ex]; - allcoins.sort((a, b) => { - if (b.denom_value !== a.denom_value) { - return b.denom_value - a.denom_value; - } - return b.denom_fraction - a.denom_fraction; - }); + {Object.keys(money_by_exchange).map((ex, idx) => { + const allcoins = money_by_exchange[ex]; + allcoins.sort((a, b) => { + if (b.denom_value !== a.denom_value) { + return b.denom_value - a.denom_value; + } + return b.denom_fraction - a.denom_fraction; + }); - const coins = allcoins.reduce( - (prev, cur) => { - if (cur.status === CoinStatus.Fresh) prev.usable.push(cur); - if (cur.status === CoinStatus.Dormant) prev.spent.push(cur); - return prev; - }, - { - spent: [], - usable: [], - } as SplitedCoinInfo, - ); + const coins = allcoins.reduce( + (prev, cur) => { + if (cur.status === CoinStatus.Fresh) prev.usable.push(cur); + if (cur.status === CoinStatus.Dormant) prev.spent.push(cur); + return prev; + }, + { + spent: [], + usable: [], + } as SplitedCoinInfo, + ); - return ( - - ); - }) - } + return ( + + ); + })}
- { - operations && operations.length > 0 && ( - -

- Pending operations -

-
- {operations.reverse().map((o) => { - return ( - -
- {o.type}{" "} -
-
-
{JSON.stringify(o, undefined, 2)}
-
-
- ); - })} -
-
- ) - } -
+ {operations && operations.length > 0 && ( + +

+ Pending operations +

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