taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 5d804540d4ec558c569a178ad2e712c9535c7f12
parent 6006fc80d74ae89e0a038bbd7d33bc3398eaad10
Author: Sebastian <sebasjm@gmail.com>
Date:   Tue, 27 May 2025 17:09:47 -0300

fix #9536

Diffstat:
Mpackages/aml-backoffice-ui/src/pages/Dashboard.tsx | 14++------------
Mpackages/taler-wallet-webextension/set-up-dev-wallet.sh | 6++++--
Mpackages/taler-wallet-webextension/src/wallet/History.tsx | 37++++++++++++++++++++++++++++++-------
3 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/packages/aml-backoffice-ui/src/pages/Dashboard.tsx b/packages/aml-backoffice-ui/src/pages/Dashboard.tsx @@ -18,35 +18,25 @@ import { AmlSpaDialect, assertUnreachable, EventReporting_TOPS_calculation, - EventReporting_TOPS_queries, GLS_AmlEventsName, - HttpStatusCode, - OperationOk, TalerCorebankApi, TalerError, - TalerExchangeErrorsByMethod, - TalerExchangeResultByMethod, - TOPS_AmlEventsName, - TranslatedString, + TranslatedString } from "@gnu-taler/taler-util"; import { - Attention, InternationalizationAPI, Loading, RouteDefinition, - UIHandlerId, useExchangeApiContext, - useTranslationContext, + useTranslationContext } from "@gnu-taler/web-util/browser"; import { format, sub } from "date-fns"; import { Fragment, h, VNode } from "preact"; -import { useMemo, useState } from "preact/hooks"; import { ErrorLoadingWithDebug } from "../components/ErrorLoadingWithDebug.js"; import { useOfficer } from "../hooks/officer.js"; import { usePreferences } from "../hooks/preferences.js"; import { useTopsServerStatistics } from "../hooks/server-info.js"; import { HandleAccountNotReady } from "./HandleAccountNotReady.js"; -import { Officer } from "./Officer.js"; export function Dashboard({ routeToDownloadStats, diff --git a/packages/taler-wallet-webextension/set-up-dev-wallet.sh b/packages/taler-wallet-webextension/set-up-dev-wallet.sh @@ -3,6 +3,8 @@ set -eu +FF=${1:-"not"} + if [[ ! -e package.json ]]; then echo "Please run this from the root of the repo.">&2 exit 1 @@ -22,7 +24,7 @@ cp -r static $TEMP_DIR/static cp -r static-dev $TEMP_DIR/static mkdir $TEMP_DIR/dist -DEV=1 INSTALL_DIR=$TEMP_DIR/dist ./build.mjs +[ $FF == "firefox" ] && DEV=1 INSTALL_DIR=$TEMP_DIR/dist ./build.mjs (cd $TEMP_DIR && zip -q -r "../$zipfile" dist static manifest.json) @@ -36,7 +38,7 @@ cp -r static-dev $TEMP_DIR/static mkdir $TEMP_DIR/dist cp -r service_worker.js $TEMP_DIR -DEV=1 INSTALL_DIR=$TEMP_DIR/dist ./build.mjs +[ $FF == "firefox" ] && DEV=1 INSTALL_DIR=$TEMP_DIR/dist ./build.mjs (cd $TEMP_DIR && zip -q -r "../$zipfile" dist static manifest.json service_worker.js) diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -19,9 +19,13 @@ import { Amounts, NotificationType, ScopeInfo, + ScopeInfoAuditor, + ScopeInfoExchange, ScopeType, Transaction, + URL, WalletBalance, + parseScopeInfoShort, stringifyScopeInfoShort, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -193,6 +197,9 @@ export function HistoryView({ const datesWithTransaction: string[] = Object.keys(transactionsByDate); + // scopes.sort((a, b) => { + // return a[1] + // }); return ( <Fragment> <section> @@ -246,17 +253,33 @@ export function HistoryView({ style={{ fontSize: "x-large", }} - value={balanceIndex} + value={scopeStr} onChange={(e) => { - const bIdx = Number.parseInt(e.currentTarget.value, 10); - changeScope(balances[bIdx].scopeInfo); + const value = e.currentTarget.value; + const sc = parseScopeInfoShort(value); + if (!sc) { + console.error("no scope for", value); + return; + } + changeScope(sc); }} > - {balances.map((entry, index) => { + {balances.map((entry, si) => { + const sc = entry.scopeInfo; + const st = stringifyScopeInfoShort(sc); + + if (sc.type === ScopeType.Global) { + return ( + <option value={st} key={st}> + {sc.currency} + </option> + ); + } + return ( - <option value={index} key={entry.scopeInfo.currency}> - {entry.scopeInfo.currency} - </option> + <optgroup label={new URL(sc.url).hostname}> + <option value={st}>{sc.currency}</option> + </optgroup> ); })} </select>