From 41850c9f14baa5330919c6dabf161b1aaeda7376 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 23 Feb 2022 15:18:37 -0300 Subject: add i18n where was missing --- .../src/popupEntryPoint.tsx | 72 +++++++++++++--------- 1 file changed, 42 insertions(+), 30 deletions(-) (limited to 'packages/taler-wallet-webextension/src/popupEntryPoint.tsx') diff --git a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx index fa0e6e3df..6e270f676 100644 --- a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx +++ b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx @@ -17,10 +17,10 @@ /** * Main entry point for extension pages. * - * @author Florian Dold + * @author sebasjm */ -import { setupI18n } from "@gnu-taler/taler-util"; +import { setupI18n, Translate } from "@gnu-taler/taler-util"; import { createHashHistory } from "history"; import { Fragment, h, render, VNode } from "preact"; import Router, { route, Route } from "preact-router"; @@ -87,27 +87,20 @@ function Application(): VNode { - - - goToWalletPage( - Pages.balance_manual_withdraw.replace(":currency?", ""), - ) + route(Pages.balance_manual_withdraw.replace(":currency?", "")) } goToWalletDeposit={(currency: string) => - goToWalletPage( - Pages.balance_deposit.replace(":currency", currency), - ) + route(Pages.balance_deposit.replace(":currency", currency)) } goToWalletHistory={(currency: string) => - goToWalletPage( - Pages.balance_history.replace(":currency", currency), - ) + route(Pages.balance_history.replace(":currency", currency)) } /> + + + + + { - route(Pages.backup); - }} + component={RedirectToWalletPage} /> - + { - route(Pages.balance); - }} + component={RedirectToWalletPage} /> + @@ -165,15 +166,26 @@ function Application(): VNode { ); } -async function goToWalletPage(page: Pages | string): Promise { - // eslint-disable-next-line no-undef - await chrome.tabs.create({ - active: true, - // eslint-disable-next-line no-undef - url: chrome.runtime.getURL(`/static/wallet.html#${page}`), +function RedirectToWalletPage(): VNode { + const page = document.location.hash || "#/"; + useEffect(() => { + chrome.tabs + .create({ + active: true, + // eslint-disable-next-line no-undef + url: chrome.runtime.getURL(`/static/wallet.html${page}`), + }) + .then(() => { + window.close(); + }); }); - window.close(); - // return null; + return ( + + + this popup is being closed and you are being redirected to {page} + + + ); } function Redirect({ to }: { to: string }): null { -- cgit v1.2.3