From 7b2de89444f27faa554bb40855da996a113ef5b9 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 13 Apr 2023 12:21:39 -0300 Subject: use /taler-uri as redirection point to all taler uris --- .../src/wallet/Application.tsx | 65 +++++++++++++--------- 1 file changed, 38 insertions(+), 27 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet/Application.tsx') diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx b/packages/taler-wallet-webextension/src/wallet/Application.tsx index 4a5ef30eb..2b03bb947 100644 --- a/packages/taler-wallet-webextension/src/wallet/Application.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx @@ -20,7 +20,11 @@ * @author sebasjm */ -import { TranslatedString } from "@gnu-taler/taler-util"; +import { + TalerUriAction, + TranslatedString, + parseTalerUri, +} from "@gnu-taler/taler-util"; import { createHashHistory } from "history"; import { ComponentChildren, Fragment, h, VNode } from "preact"; import { route, Route, Router } from "preact-router"; @@ -55,7 +59,12 @@ import { WithdrawPageFromParams, WithdrawPageFromURI, } from "../cta/Withdraw/index.js"; -import { Pages, WalletNavBar, WalletNavBarOptions } from "../NavigationBar.js"; +import { + Pages, + WalletNavBar, + WalletNavBarOptions, + getPathnameForTalerURI, +} from "../NavigationBar.js"; import { platform } from "../platform/foreground.js"; import CloseIcon from "../svg/close_24px.svg"; import { AddBackupProviderPage } from "./AddBackupProvider/index.js"; @@ -285,12 +294,22 @@ export function Application(): VNode { {/** * CALL TO ACTION */} + { + const path = getPathnameForTalerURI(uri); + if (!path) { + return ; + } + return ; + }} + /> ( + component={({ talerUri }: { talerUri: string }) => ( redirectTo(Pages.receiveCash({ amount })) } @@ -304,14 +323,10 @@ export function Application(): VNode { /> ( + component={({ talerUri }: { talerUri: string }) => ( redirectTo(Pages.receiveCash({ amount })) } @@ -325,10 +340,10 @@ export function Application(): VNode { /> ( + component={({ talerUri }: { talerUri: string }) => ( redirectTo(Pages.balance)} onSuccess={(tid: string) => redirectTo(Pages.balanceTransaction({ tid })) @@ -339,10 +354,10 @@ export function Application(): VNode { /> ( + component={({ talerUri }: { talerUri: string }) => ( redirectTo(Pages.balance)} onSuccess={(tid: string) => redirectTo(Pages.balanceTransaction({ tid })) @@ -353,14 +368,10 @@ export function Application(): VNode { /> ( + component={({ talerUri }: { talerUri: string }) => ( redirectTo(Pages.balance)} onSuccess={(tid: string) => redirectTo(Pages.balanceTransaction({ tid })) @@ -387,15 +398,15 @@ export function Application(): VNode { path={Pages.ctaDeposit} component={({ amount, - talerDepositUri, + talerUri, }: { amount: string; - talerDepositUri: string; + talerUri: string; }) => ( redirectTo(Pages.balance)} onSuccess={(tid: string) => redirectTo(Pages.balanceTransaction({ tid })) @@ -434,10 +445,10 @@ export function Application(): VNode { /> ( + component={({ talerUri }: { talerUri: string }) => ( redirectTo(Pages.receiveCash({ amount })) } @@ -451,10 +462,10 @@ export function Application(): VNode { /> ( + component={({ talerUri }: { talerUri: string }) => ( redirectTo(Pages.balance)} onSuccess={(tid: string) => redirectTo(Pages.balanceTransaction({ tid })) -- cgit v1.2.3