From 08959f83bc9f6d5df93cb6c2d34b671bf419d05a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 14 Mar 2022 15:20:32 -0300 Subject: take translator from transaltion context --- .../src/NavigationBar.tsx | 2 +- .../src/components/BankDetailsByPaytoType.tsx | 2 +- .../src/components/DebugCheckbox.tsx | 4 +- .../src/components/Diagnostics.tsx | 4 +- .../src/components/EditableText.tsx | 3 +- .../src/components/Loading.tsx | 31 ++++-- .../src/components/SelectList.tsx | 3 +- .../src/components/TransactionItem.tsx | 11 +- .../src/context/translation.ts | 13 ++- .../taler-wallet-webextension/src/cta/Deposit.tsx | 5 +- packages/taler-wallet-webextension/src/cta/Pay.tsx | 8 +- .../taler-wallet-webextension/src/cta/Refund.tsx | 5 +- .../src/cta/TermsOfServiceSection.tsx | 3 +- packages/taler-wallet-webextension/src/cta/Tip.tsx | 5 +- .../taler-wallet-webextension/src/cta/Withdraw.tsx | 8 +- .../src/cta/reset-required.tsx | 112 --------------------- .../src/cta/return-coins.tsx | 3 +- .../taler-wallet-webextension/src/hooks/useLang.ts | 2 +- .../src/hooks/useLocalStorage.ts | 5 +- .../src/popup/BalancePage.tsx | 4 +- .../src/popup/DeveloperPage.tsx | 22 ++-- .../src/popup/NoBalanceHelp.tsx | 3 +- .../src/popup/TalerActionFound.tsx | 4 +- .../src/wallet/AddNewActionView.tsx | 36 +++---- .../src/wallet/BackupPage.tsx | 7 +- .../src/wallet/CreateManualWithdraw.tsx | 4 +- .../src/wallet/DepositPage.tsx | 3 +- .../src/wallet/ExchangeAddConfirm.tsx | 3 +- .../src/wallet/ExchangeSetUrl.tsx | 4 +- .../src/wallet/History.tsx | 4 +- .../src/wallet/ManualWithdrawPage.tsx | 3 +- .../src/wallet/ProviderAddPage.tsx | 4 +- .../src/wallet/ProviderDetailPage.tsx | 13 ++- .../src/wallet/ReserveCreated.tsx | 3 +- .../src/wallet/Settings.tsx | 33 +++--- .../src/wallet/Transaction.tsx | 5 +- .../src/wallet/Welcome.tsx | 4 +- 37 files changed, 175 insertions(+), 213 deletions(-) delete mode 100644 packages/taler-wallet-webextension/src/cta/reset-required.tsx diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx b/packages/taler-wallet-webextension/src/NavigationBar.tsx index bebe9436e..8d5c1fa4d 100644 --- a/packages/taler-wallet-webextension/src/NavigationBar.tsx +++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx @@ -27,7 +27,7 @@ import { VNode, h } from "preact"; import { JustInDevMode } from "./components/JustInDevMode"; import { NavigationHeader, NavigationHeaderHolder } from "./components/styled"; -import { useTranslationContext } from "./context/translation.js"; +import { useTranslationContext } from "./context/translation"; /** * List of pages used by the wallet diff --git a/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx b/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx index 48360f7c7..f55f5c846 100644 --- a/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx +++ b/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx @@ -17,7 +17,7 @@ import { PaytoUri } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; -import { useTranslationContext } from "../context/translation.js"; +import { useTranslationContext } from "../context/translation"; import { CopiedIcon, CopyIcon } from "../svg"; import { ButtonBox, TooltipRight } from "./styled"; diff --git a/packages/taler-wallet-webextension/src/components/DebugCheckbox.tsx b/packages/taler-wallet-webextension/src/components/DebugCheckbox.tsx index b5ad7cda7..dc42b9ef7 100644 --- a/packages/taler-wallet-webextension/src/components/DebugCheckbox.tsx +++ b/packages/taler-wallet-webextension/src/components/DebugCheckbox.tsx @@ -14,8 +14,8 @@ TALER; see the file COPYING. If not, see */ -import { i18n } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; +import { useTranslationContext } from "../context/translation"; export function DebugCheckbox({ enabled, @@ -24,6 +24,8 @@ export function DebugCheckbox({ enabled: boolean; onToggle: () => void; }): VNode { + const { i18n } = useTranslationContext(); + return (
*/ -import { i18n, WalletDiagnostics } from "@gnu-taler/taler-util"; +import { WalletDiagnostics } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; +import { useTranslationContext } from "../context/translation"; import { PageLink } from "../renderHtml"; interface Props { @@ -24,6 +25,7 @@ interface Props { } export function Diagnostics({ timedOut, diagnostics }: Props): VNode { + const { i18n } = useTranslationContext(); if (timedOut) { return (

diff --git a/packages/taler-wallet-webextension/src/components/EditableText.tsx b/packages/taler-wallet-webextension/src/components/EditableText.tsx index 8d45cae90..8f342ef28 100644 --- a/packages/taler-wallet-webextension/src/components/EditableText.tsx +++ b/packages/taler-wallet-webextension/src/components/EditableText.tsx @@ -14,9 +14,9 @@ GNU Taler; see the file COPYING. If not, see */ -import { i18n } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import { useRef, useState } from "preact/hooks"; +import { useTranslationContext } from "../context/translation"; interface Props { value: string; @@ -32,6 +32,7 @@ export function EditableText({ label, description, }: Props): VNode { + const { i18n } = useTranslationContext(); const [editing, setEditing] = useState(false); const ref = useRef(null); let InputText; diff --git a/packages/taler-wallet-webextension/src/components/Loading.tsx b/packages/taler-wallet-webextension/src/components/Loading.tsx index 7504034a0..d28953a10 100644 --- a/packages/taler-wallet-webextension/src/components/Loading.tsx +++ b/packages/taler-wallet-webextension/src/components/Loading.tsx @@ -13,13 +13,30 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see */ -import { i18n } from "@gnu-taler/taler-util"; -import { h, VNode } from "preact"; +import { Fragment, h, VNode } from "preact"; +import { useEffect, useState } from "preact/hooks"; +import { useTranslationContext } from "../context/translation"; +import { CenteredText } from "./styled"; export function Loading(): VNode { - return ( -

- Loading... -
- ); + const { i18n } = useTranslationContext(); + const [tooLong, setTooLong] = useState(false); + useEffect(() => { + const id = setTimeout(() => { + setTooLong(true); + }, 500); + return () => { + clearTimeout(id); + }; + }); + if (tooLong) { + return ( +
+ + Loading... + +
+ ); + } + return ; } diff --git a/packages/taler-wallet-webextension/src/components/SelectList.tsx b/packages/taler-wallet-webextension/src/components/SelectList.tsx index 676fd672f..122b473b1 100644 --- a/packages/taler-wallet-webextension/src/components/SelectList.tsx +++ b/packages/taler-wallet-webextension/src/components/SelectList.tsx @@ -14,8 +14,8 @@ GNU Taler; see the file COPYING. If not, see */ -import { i18n } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; +import { useTranslationContext } from "../context/translation"; import { NiceSelect } from "./styled"; interface Props { @@ -39,6 +39,7 @@ export function SelectList({ description, canBeNull, }: Props): VNode { + const { i18n } = useTranslationContext(); return (