take translator from transaltion context
This commit is contained in:
parent
1d7c8f7083
commit
08959f83bc
@ -27,7 +27,7 @@
|
|||||||
import { VNode, h } from "preact";
|
import { VNode, h } from "preact";
|
||||||
import { JustInDevMode } from "./components/JustInDevMode";
|
import { JustInDevMode } from "./components/JustInDevMode";
|
||||||
import { NavigationHeader, NavigationHeaderHolder } from "./components/styled";
|
import { NavigationHeader, NavigationHeaderHolder } from "./components/styled";
|
||||||
import { useTranslationContext } from "./context/translation.js";
|
import { useTranslationContext } from "./context/translation";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of pages used by the wallet
|
* List of pages used by the wallet
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import { PaytoUri } from "@gnu-taler/taler-util";
|
import { PaytoUri } from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { useEffect, useState } from "preact/hooks";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
import { useTranslationContext } from "../context/translation.js";
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { CopiedIcon, CopyIcon } from "../svg";
|
import { CopiedIcon, CopyIcon } from "../svg";
|
||||||
import { ButtonBox, TooltipRight } from "./styled";
|
import { ButtonBox, TooltipRight } from "./styled";
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from "@gnu-taler/taler-util";
|
|
||||||
import { h, VNode } from "preact";
|
import { h, VNode } from "preact";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
|
|
||||||
export function DebugCheckbox({
|
export function DebugCheckbox({
|
||||||
enabled,
|
enabled,
|
||||||
@ -24,6 +24,8 @@ export function DebugCheckbox({
|
|||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
onToggle: () => void;
|
onToggle: () => void;
|
||||||
}): VNode {
|
}): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<input
|
<input
|
||||||
|
@ -14,8 +14,9 @@
|
|||||||
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n, WalletDiagnostics } from "@gnu-taler/taler-util";
|
import { WalletDiagnostics } from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { PageLink } from "../renderHtml";
|
import { PageLink } from "../renderHtml";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -24,6 +25,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Diagnostics({ timedOut, diagnostics }: Props): VNode {
|
export function Diagnostics({ timedOut, diagnostics }: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
if (timedOut) {
|
if (timedOut) {
|
||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from "@gnu-taler/taler-util";
|
|
||||||
import { h, VNode } from "preact";
|
import { h, VNode } from "preact";
|
||||||
import { useRef, useState } from "preact/hooks";
|
import { useRef, useState } from "preact/hooks";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: string;
|
value: string;
|
||||||
@ -32,6 +32,7 @@ export function EditableText({
|
|||||||
label,
|
label,
|
||||||
description,
|
description,
|
||||||
}: Props): VNode {
|
}: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [editing, setEditing] = useState(false);
|
const [editing, setEditing] = useState(false);
|
||||||
const ref = useRef<HTMLInputElement>(null);
|
const ref = useRef<HTMLInputElement>(null);
|
||||||
let InputText;
|
let InputText;
|
||||||
|
@ -13,13 +13,30 @@
|
|||||||
You should have received a copy of the GNU General Public License along with
|
You should have received a copy of the GNU General Public License along with
|
||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
import { i18n } from "@gnu-taler/taler-util";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { h, VNode } from "preact";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
|
import { CenteredText } from "./styled";
|
||||||
|
|
||||||
export function Loading(): VNode {
|
export function Loading(): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
|
const [tooLong, setTooLong] = useState(false);
|
||||||
|
useEffect(() => {
|
||||||
|
const id = setTimeout(() => {
|
||||||
|
setTooLong(true);
|
||||||
|
}, 500);
|
||||||
|
return () => {
|
||||||
|
clearTimeout(id);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
if (tooLong) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<section style={{ margin: "auto" }}>
|
||||||
|
<CenteredText>
|
||||||
<i18n.Translate>Loading</i18n.Translate>...
|
<i18n.Translate>Loading</i18n.Translate>...
|
||||||
</div>
|
</CenteredText>
|
||||||
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return <Fragment />;
|
||||||
|
}
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from "@gnu-taler/taler-util";
|
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { NiceSelect } from "./styled";
|
import { NiceSelect } from "./styled";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -39,6 +39,7 @@ export function SelectList({
|
|||||||
description,
|
description,
|
||||||
canBeNull,
|
canBeNull,
|
||||||
}: Props): VNode {
|
}: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<label
|
<label
|
||||||
|
@ -21,23 +21,18 @@ import {
|
|||||||
Timestamp,
|
Timestamp,
|
||||||
Transaction,
|
Transaction,
|
||||||
TransactionType,
|
TransactionType,
|
||||||
i18n,
|
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { h, VNode } from "preact";
|
import { h, VNode } from "preact";
|
||||||
import imageBank from "../../static/img/ri-bank-line.svg";
|
import { useTranslationContext } from "../context/translation";
|
||||||
import imageHandHeart from "../../static/img/ri-hand-heart-line.svg";
|
|
||||||
import imageRefresh from "../../static/img/ri-refresh-line.svg";
|
|
||||||
import imageRefund from "../../static/img/ri-refund-2-line.svg";
|
|
||||||
import imageShoppingCart from "../../static/img/ri-shopping-cart-line.svg";
|
|
||||||
import { Avatar } from "../mui/Avatar";
|
import { Avatar } from "../mui/Avatar";
|
||||||
import { Pages } from "../NavigationBar";
|
import { Pages } from "../NavigationBar";
|
||||||
import {
|
import {
|
||||||
Column,
|
Column,
|
||||||
ExtraLargeText,
|
ExtraLargeText,
|
||||||
HistoryRow,
|
HistoryRow,
|
||||||
SmallLightText,
|
|
||||||
LargeText,
|
LargeText,
|
||||||
LightText,
|
LightText,
|
||||||
|
SmallLightText,
|
||||||
} from "./styled";
|
} from "./styled";
|
||||||
import { Time } from "./Time";
|
import { Time } from "./Time";
|
||||||
|
|
||||||
@ -121,6 +116,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function TransactionLayout(props: TransactionLayoutProps): VNode {
|
function TransactionLayout(props: TransactionLayoutProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<HistoryRow
|
<HistoryRow
|
||||||
href={Pages.balance_transaction.replace(":tid", props.id)}
|
href={Pages.balance_transaction.replace(":tid", props.id)}
|
||||||
@ -183,6 +179,7 @@ interface TransactionAmountProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function TransactionAmount(props: TransactionAmountProps): VNode {
|
function TransactionAmount(props: TransactionAmountProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
let sign: string;
|
let sign: string;
|
||||||
switch (props.debitCreditIndicator) {
|
switch (props.debitCreditIndicator) {
|
||||||
case "credit":
|
case "credit":
|
||||||
|
@ -31,7 +31,8 @@ interface Type {
|
|||||||
lang: string;
|
lang: string;
|
||||||
supportedLang: { [id in keyof typeof supportedLang]: string }
|
supportedLang: { [id in keyof typeof supportedLang]: string }
|
||||||
changeLanguage: (l: string) => void;
|
changeLanguage: (l: string) => void;
|
||||||
i18n: typeof i18n
|
i18n: typeof i18n;
|
||||||
|
isSaved: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const supportedLang = {
|
const supportedLang = {
|
||||||
@ -44,7 +45,8 @@ const supportedLang = {
|
|||||||
it: "Italiano [it]",
|
it: "Italiano [it]",
|
||||||
// ko: "한국어 [ko]",
|
// ko: "한국어 [ko]",
|
||||||
// ru: "Ру́сский язы́к [ru]",
|
// ru: "Ру́сский язы́к [ru]",
|
||||||
tr: "Türk [tr]"
|
tr: "Türk [tr]",
|
||||||
|
navigator: "Defined by navigator",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +56,8 @@ const initial = {
|
|||||||
changeLanguage: () => {
|
changeLanguage: () => {
|
||||||
// do not change anything
|
// do not change anything
|
||||||
},
|
},
|
||||||
i18n
|
i18n,
|
||||||
|
isSaved: false,
|
||||||
};
|
};
|
||||||
const Context = createContext<Type>(initial);
|
const Context = createContext<Type>(initial);
|
||||||
|
|
||||||
@ -69,7 +72,7 @@ export const TranslationProvider = ({
|
|||||||
children,
|
children,
|
||||||
forceLang,
|
forceLang,
|
||||||
}: Props): VNode => {
|
}: Props): VNode => {
|
||||||
const [lang, changeLanguage] = useLang(initial);
|
const [lang, changeLanguage, isSaved] = useLang(initial);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (forceLang) {
|
if (forceLang) {
|
||||||
changeLanguage(forceLang);
|
changeLanguage(forceLang);
|
||||||
@ -83,7 +86,7 @@ export const TranslationProvider = ({
|
|||||||
} else {
|
} else {
|
||||||
setupI18n(lang, strings);
|
setupI18n(lang, strings);
|
||||||
}
|
}
|
||||||
return h(Context.Provider, { value: { lang, changeLanguage, supportedLang, i18n }, children });
|
return h(Context.Provider, { value: { lang, changeLanguage, supportedLang, i18n, isSaved }, children });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useTranslationContext = (): Type => useContext(Context);
|
export const useTranslationContext = (): Type => useContext(Context);
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
/**
|
/**
|
||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
// import * as i18n from "../i18n";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AmountJson,
|
AmountJson,
|
||||||
@ -31,7 +30,6 @@ import {
|
|||||||
ConfirmPayResult,
|
ConfirmPayResult,
|
||||||
ConfirmPayResultType,
|
ConfirmPayResultType,
|
||||||
ContractTerms,
|
ContractTerms,
|
||||||
i18n,
|
|
||||||
NotificationType,
|
NotificationType,
|
||||||
PreparePayResult,
|
PreparePayResult,
|
||||||
PreparePayResultType,
|
PreparePayResultType,
|
||||||
@ -49,6 +47,7 @@ import {
|
|||||||
WalletAction,
|
WalletAction,
|
||||||
WarningBox,
|
WarningBox,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
|
|
||||||
@ -58,6 +57,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function DepositPage({ talerPayUri, goBack }: Props): VNode {
|
export function DepositPage({ talerPayUri, goBack }: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [payStatus, setPayStatus] = useState<PreparePayResult | undefined>(
|
const [payStatus, setPayStatus] = useState<PreparePayResult | undefined>(
|
||||||
undefined,
|
undefined,
|
||||||
);
|
);
|
||||||
@ -199,6 +199,7 @@ export function PaymentRequestView({
|
|||||||
}: PaymentRequestViewProps): VNode {
|
}: PaymentRequestViewProps): VNode {
|
||||||
let totalFees: AmountJson = Amounts.getZero(payStatus.amountRaw);
|
let totalFees: AmountJson = Amounts.getZero(payStatus.amountRaw);
|
||||||
const contractTerms: ContractTerms = payStatus.contractTerms;
|
const contractTerms: ContractTerms = payStatus.contractTerms;
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WalletAction>
|
<WalletAction>
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
/**
|
/**
|
||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
// import * as i18n from "../i18n";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AmountJson,
|
AmountJson,
|
||||||
@ -32,12 +31,10 @@ import {
|
|||||||
ConfirmPayResultDone,
|
ConfirmPayResultDone,
|
||||||
ConfirmPayResultType,
|
ConfirmPayResultType,
|
||||||
ContractTerms,
|
ContractTerms,
|
||||||
i18n,
|
|
||||||
NotificationType,
|
NotificationType,
|
||||||
PreparePayResult,
|
PreparePayResult,
|
||||||
PreparePayResultType,
|
PreparePayResultType,
|
||||||
Product,
|
Product,
|
||||||
Translate,
|
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { OperationFailedError } from "@gnu-taler/taler-wallet-core";
|
import { OperationFailedError } from "@gnu-taler/taler-wallet-core";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
@ -50,13 +47,13 @@ import { Part } from "../components/Part";
|
|||||||
import { QR } from "../components/QR";
|
import { QR } from "../components/QR";
|
||||||
import {
|
import {
|
||||||
ButtonSuccess,
|
ButtonSuccess,
|
||||||
LightText,
|
|
||||||
LinkSuccess,
|
LinkSuccess,
|
||||||
SmallLightText,
|
SmallLightText,
|
||||||
SuccessBox,
|
SuccessBox,
|
||||||
WalletAction,
|
WalletAction,
|
||||||
WarningBox,
|
WarningBox,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
|
|
||||||
@ -89,6 +86,7 @@ export function PayPage({
|
|||||||
goToWalletManualWithdraw,
|
goToWalletManualWithdraw,
|
||||||
goBack,
|
goBack,
|
||||||
}: Props): VNode {
|
}: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [payResult, setPayResult] = useState<ConfirmPayResult | undefined>(
|
const [payResult, setPayResult] = useState<ConfirmPayResult | undefined>(
|
||||||
undefined,
|
undefined,
|
||||||
);
|
);
|
||||||
@ -166,6 +164,7 @@ export function PaymentRequestView({
|
|||||||
goToWalletManualWithdraw,
|
goToWalletManualWithdraw,
|
||||||
balance,
|
balance,
|
||||||
}: PaymentRequestViewProps): VNode {
|
}: PaymentRequestViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
let totalFees: AmountJson = Amounts.getZero(payStatus.amountRaw);
|
let totalFees: AmountJson = Amounts.getZero(payStatus.amountRaw);
|
||||||
const contractTerms: ContractTerms = payStatus.contractTerms;
|
const contractTerms: ContractTerms = payStatus.contractTerms;
|
||||||
|
|
||||||
@ -412,6 +411,7 @@ export function PaymentRequestView({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ProductList({ products }: { products: Product[] }): VNode {
|
function ProductList({ products }: { products: Product[] }): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<SmallLightText style={{ margin: ".5em" }}>
|
<SmallLightText style={{ margin: ".5em" }}>
|
||||||
|
@ -20,9 +20,10 @@
|
|||||||
* @author sebasjm
|
* @author sebasjm
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Amounts, ApplyRefundResponse, i18n } from "@gnu-taler/taler-util";
|
import { Amounts, ApplyRefundResponse } from "@gnu-taler/taler-util";
|
||||||
import { h, VNode } from "preact";
|
import { h, VNode } from "preact";
|
||||||
import { useEffect, useState } from "preact/hooks";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { AmountView } from "../renderHtml";
|
import { AmountView } from "../renderHtml";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ export interface ViewProps {
|
|||||||
applyResult: ApplyRefundResponse;
|
applyResult: ApplyRefundResponse;
|
||||||
}
|
}
|
||||||
export function View({ applyResult }: ViewProps): VNode {
|
export function View({ applyResult }: ViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<section class="main">
|
<section class="main">
|
||||||
<h1>GNU Taler Wallet</h1>
|
<h1>GNU Taler Wallet</h1>
|
||||||
@ -71,6 +73,7 @@ export function RefundPage({ talerRefundUri }: Props): VNode {
|
|||||||
const [applyResult, setApplyResult] = useState<
|
const [applyResult, setApplyResult] = useState<
|
||||||
ApplyRefundResponse | undefined
|
ApplyRefundResponse | undefined
|
||||||
>(undefined);
|
>(undefined);
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [errMsg, setErrMsg] = useState<string | undefined>(undefined);
|
const [errMsg, setErrMsg] = useState<string | undefined>(undefined);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { i18n, Translate } from "@gnu-taler/taler-util";
|
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { CheckboxOutlined } from "../components/CheckboxOutlined";
|
import { CheckboxOutlined } from "../components/CheckboxOutlined";
|
||||||
import { ExchangeXmlTos } from "../components/ExchangeToS";
|
import { ExchangeXmlTos } from "../components/ExchangeToS";
|
||||||
@ -10,6 +9,7 @@ import {
|
|||||||
WarningBox,
|
WarningBox,
|
||||||
WarningText,
|
WarningText,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { TermsState } from "../utils/index";
|
import { TermsState } from "../utils/index";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -26,6 +26,7 @@ export function TermsOfServiceSection({
|
|||||||
onAccept,
|
onAccept,
|
||||||
onReview,
|
onReview,
|
||||||
}: Props): VNode {
|
}: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
if (!reviewing) {
|
if (!reviewing) {
|
||||||
if (!reviewed) {
|
if (!reviewed) {
|
||||||
if (!onReview) {
|
if (!onReview) {
|
||||||
|
@ -20,10 +20,11 @@
|
|||||||
* @author sebasjm <dold@taler.net>
|
* @author sebasjm <dold@taler.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PrepareTipResult, i18n } from "@gnu-taler/taler-util";
|
import { PrepareTipResult } from "@gnu-taler/taler-util";
|
||||||
import { h, VNode } from "preact";
|
import { h, VNode } from "preact";
|
||||||
import { useEffect, useState } from "preact/hooks";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
import { Loading } from "../components/Loading";
|
import { Loading } from "../components/Loading";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { AmountView } from "../renderHtml";
|
import { AmountView } from "../renderHtml";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ export function View({
|
|||||||
onAccept,
|
onAccept,
|
||||||
onIgnore,
|
onIgnore,
|
||||||
}: ViewProps): VNode {
|
}: ViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<section class="main">
|
<section class="main">
|
||||||
<h1>GNU Taler Wallet</h1>
|
<h1>GNU Taler Wallet</h1>
|
||||||
@ -77,6 +79,7 @@ export function View({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function TipPage({ talerTipUri }: Props): VNode {
|
export function TipPage({ talerTipUri }: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [updateCounter, setUpdateCounter] = useState<number>(0);
|
const [updateCounter, setUpdateCounter] = useState<number>(0);
|
||||||
const [prepareTipResult, setPrepareTipResult] = useState<
|
const [prepareTipResult, setPrepareTipResult] = useState<
|
||||||
PrepareTipResult | undefined
|
PrepareTipResult | undefined
|
||||||
|
@ -25,7 +25,6 @@ import {
|
|||||||
AmountJson,
|
AmountJson,
|
||||||
Amounts,
|
Amounts,
|
||||||
ExchangeListItem,
|
ExchangeListItem,
|
||||||
i18n,
|
|
||||||
Translate,
|
Translate,
|
||||||
WithdrawUriInfoResponse,
|
WithdrawUriInfoResponse,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
@ -52,6 +51,7 @@ import {
|
|||||||
} from "../utils/index";
|
} from "../utils/index";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
import { TermsOfServiceSection } from "./TermsOfServiceSection";
|
import { TermsOfServiceSection } from "./TermsOfServiceSection";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
talerWithdrawUri?: string;
|
talerWithdrawUri?: string;
|
||||||
@ -84,6 +84,7 @@ export function View({
|
|||||||
onAccept,
|
onAccept,
|
||||||
reviewed,
|
reviewed,
|
||||||
}: ViewProps): VNode {
|
}: ViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [withdrawError, setWithdrawError] = useState<
|
const [withdrawError, setWithdrawError] = useState<
|
||||||
OperationFailedError | undefined
|
OperationFailedError | undefined
|
||||||
>(undefined);
|
>(undefined);
|
||||||
@ -236,12 +237,10 @@ export function WithdrawPageWithParsedURI({
|
|||||||
uri: string;
|
uri: string;
|
||||||
uriInfo: WithdrawUriInfoResponse;
|
uriInfo: WithdrawUriInfoResponse;
|
||||||
}): VNode {
|
}): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [customExchange, setCustomExchange] = useState<string | undefined>(
|
const [customExchange, setCustomExchange] = useState<string | undefined>(
|
||||||
undefined,
|
undefined,
|
||||||
);
|
);
|
||||||
// const [errorAccepting, setErrorAccepting] = useState<string | undefined>(
|
|
||||||
// undefined,
|
|
||||||
// );
|
|
||||||
|
|
||||||
const [reviewing, setReviewing] = useState<boolean>(false);
|
const [reviewing, setReviewing] = useState<boolean>(false);
|
||||||
const [reviewed, setReviewed] = useState<boolean>(false);
|
const [reviewed, setReviewed] = useState<boolean>(false);
|
||||||
@ -332,6 +331,7 @@ export function WithdrawPageWithParsedURI({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
export function WithdrawPage({ talerWithdrawUri }: Props): VNode {
|
export function WithdrawPage({ talerWithdrawUri }: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const uriInfoHook = useAsyncAsHook(() =>
|
const uriInfoHook = useAsyncAsHook(() =>
|
||||||
!talerWithdrawUri
|
!talerWithdrawUri
|
||||||
? Promise.reject(undefined)
|
? Promise.reject(undefined)
|
||||||
|
@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of TALER
|
|
||||||
(C) 2017 GNUnet e.V.
|
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
|
||||||
terms of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation; either version 3, or (at your option) any later version.
|
|
||||||
|
|
||||||
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
|
||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Page to inform the user when a database reset is required.
|
|
||||||
*
|
|
||||||
* @author sebasjm
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { i18n } from "@gnu-taler/taler-util";
|
|
||||||
import { Component, h, VNode } from "preact";
|
|
||||||
import * as wxApi from "../wxApi";
|
|
||||||
|
|
||||||
interface State {
|
|
||||||
/**
|
|
||||||
* Did the user check the confirmation check box?
|
|
||||||
*/
|
|
||||||
checked: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Do we actually need to reset the db?
|
|
||||||
*/
|
|
||||||
resetRequired: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ResetNotification extends Component<any, State> {
|
|
||||||
constructor(props: any) {
|
|
||||||
super(props);
|
|
||||||
this.state = { checked: false, resetRequired: true };
|
|
||||||
setInterval(() => this.update(), 500);
|
|
||||||
}
|
|
||||||
async update(): Promise<void> {
|
|
||||||
const res = await wxApi.checkUpgrade();
|
|
||||||
this.setState({ resetRequired: res.dbResetRequired });
|
|
||||||
}
|
|
||||||
render(): VNode {
|
|
||||||
if (this.state.resetRequired) {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<h1>
|
|
||||||
<i18n.Translate>Manual Reset Required</i18n.Translate>
|
|
||||||
</h1>
|
|
||||||
<p>
|
|
||||||
<i18n.Translate>
|
|
||||||
The wallet's database in your browser is incompatible with
|
|
||||||
the currently installed wallet. Please reset manually.
|
|
||||||
</i18n.Translate>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<i18n.Translate>
|
|
||||||
Once the database format has stabilized, we will provide automatic
|
|
||||||
upgrades.
|
|
||||||
</i18n.Translate>
|
|
||||||
</p>
|
|
||||||
<input
|
|
||||||
id="check"
|
|
||||||
type="checkbox"
|
|
||||||
checked={this.state.checked}
|
|
||||||
onChange={() => {
|
|
||||||
this.setState((prev) => ({ checked: prev.checked }));
|
|
||||||
}}
|
|
||||||
/>{" "}
|
|
||||||
<label htmlFor="check">
|
|
||||||
<i18n.Translate>
|
|
||||||
I understand that I will lose all my data
|
|
||||||
</i18n.Translate>
|
|
||||||
</label>
|
|
||||||
<br />
|
|
||||||
<button
|
|
||||||
class="pure-button"
|
|
||||||
disabled={!this.state.checked}
|
|
||||||
onClick={() => wxApi.resetDb()}
|
|
||||||
>
|
|
||||||
<i18n.Translate>Reset</i18n.Translate>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<h1>
|
|
||||||
<i18n.Translate>Everything is fine!</i18n.Translate>
|
|
||||||
</h1>
|
|
||||||
<p>
|
|
||||||
<i18n.Translate>
|
|
||||||
A reset is not required anymore, you can close this page.
|
|
||||||
</i18n.Translate>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated to be removed
|
|
||||||
*/
|
|
||||||
export function createResetRequiredPage(): VNode {
|
|
||||||
return <ResetNotification />;
|
|
||||||
}
|
|
@ -14,8 +14,8 @@
|
|||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from "@gnu-taler/taler-util";
|
|
||||||
import { h, VNode } from "preact";
|
import { h, VNode } from "preact";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
/**
|
/**
|
||||||
* Return coins to own bank account.
|
* Return coins to own bank account.
|
||||||
*
|
*
|
||||||
@ -26,6 +26,7 @@ import { h, VNode } from "preact";
|
|||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
export function createReturnCoinsPage(): VNode {
|
export function createReturnCoinsPage(): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
<i18n.Translate>Not implemented yet.</i18n.Translate>
|
<i18n.Translate>Not implemented yet.</i18n.Translate>
|
||||||
|
@ -22,7 +22,7 @@ function getBrowserLang(): string | undefined {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useLang(initial?: string): [string, (s: string) => void] {
|
export function useLang(initial?: string): [string, (s: string) => void, boolean] {
|
||||||
const defaultLang = (getBrowserLang() || initial || "en").substring(0, 2);
|
const defaultLang = (getBrowserLang() || initial || "en").substring(0, 2);
|
||||||
return useNotNullLocalStorage("lang-preference", defaultLang);
|
return useNotNullLocalStorage("lang-preference", defaultLang);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ export function useLocalStorage(
|
|||||||
export function useNotNullLocalStorage(
|
export function useNotNullLocalStorage(
|
||||||
key: string,
|
key: string,
|
||||||
initialValue: string,
|
initialValue: string,
|
||||||
): [string, StateUpdater<string>] {
|
): [string, StateUpdater<string>, boolean] {
|
||||||
const [storedValue, setStoredValue] = useState<string>((): string => {
|
const [storedValue, setStoredValue] = useState<string>((): string => {
|
||||||
return typeof window !== "undefined"
|
return typeof window !== "undefined"
|
||||||
? window.localStorage.getItem(key) || initialValue
|
? window.localStorage.getItem(key) || initialValue
|
||||||
@ -75,5 +75,6 @@ export function useNotNullLocalStorage(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return [storedValue, setValue];
|
const isSaved = window.localStorage.getItem(key) !== null;
|
||||||
|
return [storedValue, setValue, isSaved];
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
import {
|
import {
|
||||||
Amounts,
|
Amounts,
|
||||||
Balance,
|
Balance,
|
||||||
i18n,
|
|
||||||
NotificationType,
|
NotificationType,
|
||||||
Transaction,
|
Transaction,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
@ -29,6 +28,7 @@ import { Loading } from "../components/Loading";
|
|||||||
import { LoadingError } from "../components/LoadingError";
|
import { LoadingError } from "../components/LoadingError";
|
||||||
import { MultiActionButton } from "../components/MultiActionButton";
|
import { MultiActionButton } from "../components/MultiActionButton";
|
||||||
import { ButtonBoxPrimary, ButtonPrimary } from "../components/styled";
|
import { ButtonBoxPrimary, ButtonPrimary } from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import { AddNewActionView } from "../wallet/AddNewActionView";
|
import { AddNewActionView } from "../wallet/AddNewActionView";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
@ -44,6 +44,7 @@ export function BalancePage({
|
|||||||
goToWalletDeposit,
|
goToWalletDeposit,
|
||||||
goToWalletHistory,
|
goToWalletHistory,
|
||||||
}: Props): VNode {
|
}: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [addingAction, setAddingAction] = useState(false);
|
const [addingAction, setAddingAction] = useState(false);
|
||||||
const state = useAsyncAsHook(wxApi.getBalance, [
|
const state = useAsyncAsHook(wxApi.getBalance, [
|
||||||
NotificationType.WithdrawGroupFinished,
|
NotificationType.WithdrawGroupFinished,
|
||||||
@ -92,6 +93,7 @@ export function BalanceView({
|
|||||||
goToWalletHistory,
|
goToWalletHistory,
|
||||||
goToAddAction,
|
goToAddAction,
|
||||||
}: BalanceViewProps): VNode {
|
}: BalanceViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const currencyWithNonZeroAmount = balances
|
const currencyWithNonZeroAmount = balances
|
||||||
.filter((b) => !Amounts.isZero(b.available))
|
.filter((b) => !Amounts.isZero(b.available))
|
||||||
.map((b) => b.available.split(":")[0]);
|
.map((b) => b.available.split(":")[0]);
|
||||||
|
@ -21,7 +21,6 @@ import {
|
|||||||
ExchangeListItem,
|
ExchangeListItem,
|
||||||
NotificationType,
|
NotificationType,
|
||||||
Translate,
|
Translate,
|
||||||
i18n,
|
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { PendingTaskInfo } from "@gnu-taler/taler-wallet-core";
|
import { PendingTaskInfo } from "@gnu-taler/taler-wallet-core";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
@ -30,6 +29,7 @@ import { useRef, useState } from "preact/hooks";
|
|||||||
import { Diagnostics } from "../components/Diagnostics";
|
import { Diagnostics } from "../components/Diagnostics";
|
||||||
import { NotifyUpdateFadeOut } from "../components/styled";
|
import { NotifyUpdateFadeOut } from "../components/styled";
|
||||||
import { Time } from "../components/Time";
|
import { Time } from "../components/Time";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import { useDiagnostics } from "../hooks/useDiagnostics";
|
import { useDiagnostics } from "../hooks/useDiagnostics";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
@ -110,6 +110,7 @@ export function View({
|
|||||||
coins,
|
coins,
|
||||||
onDownloadDatabase,
|
onDownloadDatabase,
|
||||||
}: Props): VNode {
|
}: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [downloadedDatabase, setDownloadedDatabase] = useState<
|
const [downloadedDatabase, setDownloadedDatabase] = useState<
|
||||||
{ time: Date; content: string } | undefined
|
{ time: Date; content: string } | undefined
|
||||||
>(undefined);
|
>(undefined);
|
||||||
@ -153,7 +154,13 @@ export function View({
|
|||||||
<p>
|
<p>
|
||||||
<i18n.Translate>Debug tools</i18n.Translate>:
|
<i18n.Translate>Debug tools</i18n.Translate>:
|
||||||
</p>
|
</p>
|
||||||
<button onClick={confirmReset}>
|
<button
|
||||||
|
onClick={() =>
|
||||||
|
confirmReset(
|
||||||
|
i18n.str`Do you want to IRREVOCABLY DESTROY everything inside your wallet and LOSE ALL YOUR COINS?`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
<i18n.Translate>reset</i18n.Translate>
|
<i18n.Translate>reset</i18n.Translate>
|
||||||
</button>
|
</button>
|
||||||
<br />
|
<br />
|
||||||
@ -262,6 +269,7 @@ function ShowAllCoins({
|
|||||||
coins: SplitedCoinInfo;
|
coins: SplitedCoinInfo;
|
||||||
currencies: { [ex: string]: string };
|
currencies: { [ex: string]: string };
|
||||||
}) {
|
}) {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [collapsedSpent, setCollapsedSpent] = useState(true);
|
const [collapsedSpent, setCollapsedSpent] = useState(true);
|
||||||
const [collapsedUnspent, setCollapsedUnspent] = useState(false);
|
const [collapsedUnspent, setCollapsedUnspent] = useState(false);
|
||||||
const total = coins.usable.reduce((prev, cur) => prev + cur.denom_value, 0);
|
const total = coins.usable.reduce((prev, cur) => prev + cur.denom_value, 0);
|
||||||
@ -372,12 +380,10 @@ export function reload(): void {
|
|||||||
|
|
||||||
function runIntegrationTest() {}
|
function runIntegrationTest() {}
|
||||||
|
|
||||||
export async function confirmReset(): Promise<void> {
|
export async function confirmReset(
|
||||||
if (
|
confirmTheResetMessage: string,
|
||||||
confirm(
|
): Promise<void> {
|
||||||
i18n.str`Do you want to IRREVOCABLY DESTROY everything inside your wallet and LOSE ALL YOUR COINS?`,
|
if (confirm(confirmTheResetMessage)) {
|
||||||
)
|
|
||||||
) {
|
|
||||||
await wxApi.resetDb();
|
await wxApi.resetDb();
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import { i18n } from "@gnu-taler/taler-util";
|
|
||||||
import { h, VNode } from "preact";
|
import { h, VNode } from "preact";
|
||||||
import { ButtonBoxWarning, WarningBox } from "../components/styled";
|
import { ButtonBoxWarning, WarningBox } from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
|
|
||||||
export function NoBalanceHelp({
|
export function NoBalanceHelp({
|
||||||
goToWalletManualWithdraw,
|
goToWalletManualWithdraw,
|
||||||
}: {
|
}: {
|
||||||
goToWalletManualWithdraw: () => void;
|
goToWalletManualWithdraw: () => void;
|
||||||
}): VNode {
|
}): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<WarningBox>
|
<WarningBox>
|
||||||
<p>
|
<p>
|
||||||
|
@ -19,9 +19,10 @@
|
|||||||
* @author Sebastian Javier Marchano (sebasjm)
|
* @author Sebastian Javier Marchano (sebasjm)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { classifyTalerUri, TalerUriType, i18n } from "@gnu-taler/taler-util";
|
import { classifyTalerUri, TalerUriType } from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h } from "preact";
|
import { Fragment, h } from "preact";
|
||||||
import { ButtonPrimary, ButtonSuccess } from "../components/styled";
|
import { ButtonPrimary, ButtonSuccess } from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { actionForTalerUri } from "../utils/index";
|
import { actionForTalerUri } from "../utils/index";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@ -49,6 +50,7 @@ async function navigateTo(url?: string) {
|
|||||||
|
|
||||||
export function TalerActionFound({ url, onDismiss }: Props) {
|
export function TalerActionFound({ url, onDismiss }: Props) {
|
||||||
const uriType = classifyTalerUri(url);
|
const uriType = classifyTalerUri(url);
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<section>
|
<section>
|
||||||
|
@ -1,32 +1,18 @@
|
|||||||
import { classifyTalerUri, TalerUriType, i18n } from "@gnu-taler/taler-util";
|
import { classifyTalerUri, TalerUriType } from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
import { Button, ButtonSuccess, InputWithLabel } from "../components/styled";
|
import { Button, ButtonSuccess, InputWithLabel } from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { actionForTalerUri } from "../utils/index";
|
import { actionForTalerUri } from "../utils/index";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buttonLabelByTalerType(type: TalerUriType): VNode {
|
|
||||||
switch (type) {
|
|
||||||
case TalerUriType.TalerNotifyReserve:
|
|
||||||
return <i18n.Translate>Open reserve page</i18n.Translate>;
|
|
||||||
case TalerUriType.TalerPay:
|
|
||||||
return <i18n.Translate>Open pay page</i18n.Translate>;
|
|
||||||
case TalerUriType.TalerRefund:
|
|
||||||
return <i18n.Translate>Open refund page</i18n.Translate>;
|
|
||||||
case TalerUriType.TalerTip:
|
|
||||||
return <i18n.Translate>Open tip page</i18n.Translate>;
|
|
||||||
case TalerUriType.TalerWithdraw:
|
|
||||||
return <i18n.Translate>Open withdraw page</i18n.Translate>;
|
|
||||||
}
|
|
||||||
return <Fragment />;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AddNewActionView({ onCancel }: Props): VNode {
|
export function AddNewActionView({ onCancel }: Props): VNode {
|
||||||
const [url, setUrl] = useState("");
|
const [url, setUrl] = useState("");
|
||||||
const uriType = classifyTalerUri(url);
|
const uriType = classifyTalerUri(url);
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@ -57,7 +43,21 @@ export function AddNewActionView({ onCancel }: Props): VNode {
|
|||||||
chrome.tabs.create({ url: actionForTalerUri(uriType, url) });
|
chrome.tabs.create({ url: actionForTalerUri(uriType, url) });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{buttonLabelByTalerType(uriType)}
|
{(() => {
|
||||||
|
switch (uriType) {
|
||||||
|
case TalerUriType.TalerNotifyReserve:
|
||||||
|
return <i18n.Translate>Open reserve page</i18n.Translate>;
|
||||||
|
case TalerUriType.TalerPay:
|
||||||
|
return <i18n.Translate>Open pay page</i18n.Translate>;
|
||||||
|
case TalerUriType.TalerRefund:
|
||||||
|
return <i18n.Translate>Open refund page</i18n.Translate>;
|
||||||
|
case TalerUriType.TalerTip:
|
||||||
|
return <i18n.Translate>Open tip page</i18n.Translate>;
|
||||||
|
case TalerUriType.TalerWithdraw:
|
||||||
|
return <i18n.Translate>Open withdraw page</i18n.Translate>;
|
||||||
|
}
|
||||||
|
return <Fragment />;
|
||||||
|
})()}
|
||||||
</ButtonSuccess>
|
</ButtonSuccess>
|
||||||
)}
|
)}
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n, Timestamp, Translate } from "@gnu-taler/taler-util";
|
import { Timestamp, Translate } from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
ProviderInfo,
|
ProviderInfo,
|
||||||
ProviderPaymentPaid,
|
ProviderPaymentPaid,
|
||||||
@ -40,6 +40,7 @@ import {
|
|||||||
SmallLightText,
|
SmallLightText,
|
||||||
SmallText,
|
SmallText,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import { Pages } from "../NavigationBar";
|
import { Pages } from "../NavigationBar";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
@ -65,6 +66,7 @@ interface Props {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
export function BackupPage({ onAddProvider }: Props): VNode {
|
export function BackupPage({ onAddProvider }: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const status = useAsyncAsHook(wxApi.getBackupInfo);
|
const status = useAsyncAsHook(wxApi.getBackupInfo);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
return <Loading />;
|
return <Loading />;
|
||||||
@ -110,6 +112,7 @@ export function BackupView({
|
|||||||
onAddProvider,
|
onAddProvider,
|
||||||
onSyncAll,
|
onSyncAll,
|
||||||
}: ViewProps): VNode {
|
}: ViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<section>
|
<section>
|
||||||
@ -164,6 +167,7 @@ interface TransactionLayoutProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function BackupLayout(props: TransactionLayoutProps): VNode {
|
function BackupLayout(props: TransactionLayoutProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const date = !props.timestamp ? undefined : new Date(props.timestamp.t_ms);
|
const date = !props.timestamp ? undefined : new Date(props.timestamp.t_ms);
|
||||||
const dateStr = date?.toLocaleString([], {
|
const dateStr = date?.toLocaleString([], {
|
||||||
dateStyle: "medium",
|
dateStyle: "medium",
|
||||||
@ -205,6 +209,7 @@ function BackupLayout(props: TransactionLayoutProps): VNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ExpirationText({ until }: { until: Timestamp }): VNode {
|
function ExpirationText({ until }: { until: Timestamp }): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<CenteredText>
|
<CenteredText>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* @author Sebastian Javier Marchano (sebasjm)
|
* @author Sebastian Javier Marchano (sebasjm)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AmountJson, Amounts, i18n, Translate } from "@gnu-taler/taler-util";
|
import { AmountJson, Amounts } from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
import { ErrorMessage } from "../components/ErrorMessage";
|
import { ErrorMessage } from "../components/ErrorMessage";
|
||||||
@ -34,6 +34,7 @@ import {
|
|||||||
LightText,
|
LightText,
|
||||||
LinkPrimary,
|
LinkPrimary,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
error: string | undefined;
|
error: string | undefined;
|
||||||
@ -52,6 +53,7 @@ export function CreateManualWithdraw({
|
|||||||
onCreate,
|
onCreate,
|
||||||
onAddExchange,
|
onAddExchange,
|
||||||
}: Props): VNode {
|
}: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const exchangeSelectList = Object.keys(exchangeList);
|
const exchangeSelectList = Object.keys(exchangeList);
|
||||||
const currencySelectList = Object.values(exchangeList);
|
const currencySelectList = Object.values(exchangeList);
|
||||||
const exchangeMap = exchangeSelectList.reduce(
|
const exchangeMap = exchangeSelectList.reduce(
|
||||||
|
@ -19,7 +19,6 @@ import {
|
|||||||
Amounts,
|
Amounts,
|
||||||
AmountString,
|
AmountString,
|
||||||
PaytoUri,
|
PaytoUri,
|
||||||
i18n,
|
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { DepositFee } from "@gnu-taler/taler-wallet-core/src/operations/deposits";
|
import { DepositFee } from "@gnu-taler/taler-wallet-core/src/operations/deposits";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
@ -34,6 +33,7 @@ import {
|
|||||||
InputWithLabel,
|
InputWithLabel,
|
||||||
WarningBox,
|
WarningBox,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
|
|
||||||
@ -103,6 +103,7 @@ export function View({
|
|||||||
onSend,
|
onSend,
|
||||||
onCalculateFee,
|
onCalculateFee,
|
||||||
}: ViewProps): VNode {
|
}: ViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const accountMap = createLabelsForBankAccount(knownBankAccounts);
|
const accountMap = createLabelsForBankAccount(knownBankAccounts);
|
||||||
const [accountIdx, setAccountIdx] = useState(0);
|
const [accountIdx, setAccountIdx] = useState(0);
|
||||||
const [amount, setAmount] = useState<number | undefined>(undefined);
|
const [amount, setAmount] = useState<number | undefined>(undefined);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { i18n, Translate } from "@gnu-taler/taler-util";
|
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
import { Button, ButtonSuccess, ButtonWarning } from "../components/styled";
|
import { Button, ButtonSuccess, ButtonWarning } from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { TermsOfServiceSection } from "../cta/TermsOfServiceSection";
|
import { TermsOfServiceSection } from "../cta/TermsOfServiceSection";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import { buildTermsOfServiceState, TermsState } from "../utils/index";
|
import { buildTermsOfServiceState, TermsState } from "../utils/index";
|
||||||
@ -77,6 +77,7 @@ export function View({
|
|||||||
onConfirm,
|
onConfirm,
|
||||||
onCancel,
|
onCancel,
|
||||||
}: ViewProps): VNode {
|
}: ViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const needsReview =
|
const needsReview =
|
||||||
!terms || terms.status === "changed" || terms.status === "new";
|
!terms || terms.status === "changed" || terms.status === "new";
|
||||||
const [reviewed, setReviewed] = useState<boolean>(false);
|
const [reviewed, setReviewed] = useState<boolean>(false);
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
canonicalizeBaseUrl,
|
canonicalizeBaseUrl,
|
||||||
i18n,
|
|
||||||
TalerConfigResponse,
|
TalerConfigResponse,
|
||||||
Translate,
|
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h } from "preact";
|
import { Fragment, h } from "preact";
|
||||||
import { useEffect, useState } from "preact/hooks";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
@ -14,6 +12,7 @@ import {
|
|||||||
LightText,
|
LightText,
|
||||||
WarningBox,
|
WarningBox,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
initialValue?: string;
|
initialValue?: string;
|
||||||
@ -81,6 +80,7 @@ export function ExchangeSetUrlPage({
|
|||||||
onVerify,
|
onVerify,
|
||||||
onConfirm,
|
onConfirm,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const { loading, result, endpoint, updateEndpoint, error } =
|
const { loading, result, endpoint, updateEndpoint, error } =
|
||||||
useEndpointStatus(initialValue ?? "", onVerify);
|
useEndpointStatus(initialValue ?? "", onVerify);
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ import {
|
|||||||
Balance,
|
Balance,
|
||||||
NotificationType,
|
NotificationType,
|
||||||
Transaction,
|
Transaction,
|
||||||
i18n,
|
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
@ -37,6 +36,7 @@ import {
|
|||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
import { Time } from "../components/Time";
|
import { Time } from "../components/Time";
|
||||||
import { TransactionItem } from "../components/TransactionItem";
|
import { TransactionItem } from "../components/TransactionItem";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import { NoBalanceHelp } from "../popup/NoBalanceHelp";
|
import { NoBalanceHelp } from "../popup/NoBalanceHelp";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
@ -51,6 +51,7 @@ export function HistoryPage({
|
|||||||
goToWalletManualWithdraw,
|
goToWalletManualWithdraw,
|
||||||
goToWalletDeposit,
|
goToWalletDeposit,
|
||||||
}: Props): VNode {
|
}: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const balance = useAsyncAsHook(wxApi.getBalance);
|
const balance = useAsyncAsHook(wxApi.getBalance);
|
||||||
const balanceWithoutError = balance?.hasError
|
const balanceWithoutError = balance?.hasError
|
||||||
? []
|
? []
|
||||||
@ -106,6 +107,7 @@ export function HistoryView({
|
|||||||
transactions: Transaction[];
|
transactions: Transaction[];
|
||||||
balances: Balance[];
|
balances: Balance[];
|
||||||
}): VNode {
|
}): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const currencies = balances.map((b) => b.available.split(":")[0]);
|
const currencies = balances.map((b) => b.available.split(":")[0]);
|
||||||
|
|
||||||
const defaultCurrencyIndex = currencies.findIndex(
|
const defaultCurrencyIndex = currencies.findIndex(
|
||||||
|
@ -19,12 +19,12 @@ import {
|
|||||||
AmountJson,
|
AmountJson,
|
||||||
Amounts,
|
Amounts,
|
||||||
NotificationType,
|
NotificationType,
|
||||||
i18n,
|
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { h, VNode } from "preact";
|
import { h, VNode } from "preact";
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
import { Loading } from "../components/Loading";
|
import { Loading } from "../components/Loading";
|
||||||
import { LoadingError } from "../components/LoadingError";
|
import { LoadingError } from "../components/LoadingError";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import { Pages } from "../NavigationBar";
|
import { Pages } from "../NavigationBar";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
@ -51,6 +51,7 @@ export function ManualWithdrawPage({ currency, onCancel }: Props): VNode {
|
|||||||
const state = useAsyncAsHook(wxApi.listExchanges, [
|
const state = useAsyncAsHook(wxApi.listExchanges, [
|
||||||
NotificationType.ExchangeAdded,
|
NotificationType.ExchangeAdded,
|
||||||
]);
|
]);
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
|
|
||||||
async function doCreate(
|
async function doCreate(
|
||||||
exchangeBaseUrl: string,
|
exchangeBaseUrl: string,
|
||||||
|
@ -18,7 +18,6 @@ import {
|
|||||||
Amounts,
|
Amounts,
|
||||||
BackupBackupProviderTerms,
|
BackupBackupProviderTerms,
|
||||||
canonicalizeBaseUrl,
|
canonicalizeBaseUrl,
|
||||||
i18n,
|
|
||||||
Translate,
|
Translate,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
@ -32,6 +31,7 @@ import {
|
|||||||
LightText,
|
LightText,
|
||||||
SmallLightText,
|
SmallLightText,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { queryToSlashConfig } from "../utils/index";
|
import { queryToSlashConfig } from "../utils/index";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
|
|
||||||
@ -90,6 +90,7 @@ export function SetUrlView({
|
|||||||
onConfirm,
|
onConfirm,
|
||||||
withError,
|
withError,
|
||||||
}: SetUrlViewProps) {
|
}: SetUrlViewProps) {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const [value, setValue] = useState<string>(initialValue || "");
|
const [value, setValue] = useState<string>(initialValue || "");
|
||||||
const [urlError, setUrlError] = useState(false);
|
const [urlError, setUrlError] = useState(false);
|
||||||
const [name, setName] = useState<string | undefined>(undefined);
|
const [name, setName] = useState<string | undefined>(undefined);
|
||||||
@ -190,6 +191,7 @@ export function ConfirmProviderView({
|
|||||||
onConfirm,
|
onConfirm,
|
||||||
}: ConfirmProviderViewProps) {
|
}: ConfirmProviderViewProps) {
|
||||||
const [accepted, setAccepted] = useState(false);
|
const [accepted, setAccepted] = useState(false);
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from "@gnu-taler/taler-util";
|
import * as utils from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
ProviderInfo,
|
ProviderInfo,
|
||||||
ProviderPaymentStatus,
|
ProviderPaymentStatus,
|
||||||
@ -32,6 +32,7 @@ import {
|
|||||||
SmallLightText,
|
SmallLightText,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
import { Time } from "../components/Time";
|
import { Time } from "../components/Time";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function ProviderDetailPage({ pid: providerURL, onBack }: Props): VNode {
|
export function ProviderDetailPage({ pid: providerURL, onBack }: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
async function getProviderInfo(): Promise<ProviderInfo | null> {
|
async function getProviderInfo(): Promise<ProviderInfo | null> {
|
||||||
//create a first list of backup info by currency
|
//create a first list of backup info by currency
|
||||||
const status = await wxApi.getBackupInfo();
|
const status = await wxApi.getBackupInfo();
|
||||||
@ -100,6 +102,7 @@ export function ProviderView({
|
|||||||
onBack,
|
onBack,
|
||||||
onExtend,
|
onExtend,
|
||||||
}: ViewProps): VNode {
|
}: ViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
if (info === null) {
|
if (info === null) {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@ -156,7 +159,7 @@ export function ProviderView({
|
|||||||
</p>
|
</p>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)}
|
)}
|
||||||
<p>{descriptionByStatus(info.paymentStatus)}</p>
|
<p>{descriptionByStatus(info.paymentStatus, i18n)}</p>
|
||||||
<ButtonPrimary disabled onClick={onExtend}>
|
<ButtonPrimary disabled onClick={onExtend}>
|
||||||
<i18n.Translate>Extend</i18n.Translate>
|
<i18n.Translate>Extend</i18n.Translate>
|
||||||
</ButtonPrimary>
|
</ButtonPrimary>
|
||||||
@ -219,6 +222,7 @@ export function ProviderView({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Error({ info }: { info: ProviderInfo }): VNode {
|
function Error({ info }: { info: ProviderInfo }): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
if (info.lastError) {
|
if (info.lastError) {
|
||||||
return (
|
return (
|
||||||
<ErrorMessage
|
<ErrorMessage
|
||||||
@ -267,7 +271,10 @@ function Error({ info }: { info: ProviderInfo }): VNode {
|
|||||||
return <Fragment />;
|
return <Fragment />;
|
||||||
}
|
}
|
||||||
|
|
||||||
function descriptionByStatus(status: ProviderPaymentStatus): VNode {
|
function descriptionByStatus(
|
||||||
|
status: ProviderPaymentStatus,
|
||||||
|
i18n: typeof utils.i18n,
|
||||||
|
): VNode {
|
||||||
switch (status.type) {
|
switch (status.type) {
|
||||||
case ProviderPaymentType.Paid:
|
case ProviderPaymentType.Paid:
|
||||||
case ProviderPaymentType.TermsChanged:
|
case ProviderPaymentType.TermsChanged:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
AmountJson,
|
AmountJson,
|
||||||
parsePaytoUri,
|
parsePaytoUri,
|
||||||
i18n,
|
|
||||||
Amounts,
|
Amounts,
|
||||||
segwitMinAmount,
|
segwitMinAmount,
|
||||||
generateFakeSegwitAddress,
|
generateFakeSegwitAddress,
|
||||||
@ -10,6 +9,7 @@ import { Fragment, h, VNode } from "preact";
|
|||||||
import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType";
|
import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType";
|
||||||
import { QR } from "../components/QR";
|
import { QR } from "../components/QR";
|
||||||
import { ButtonDestructive, WarningBox } from "../components/styled";
|
import { ButtonDestructive, WarningBox } from "../components/styled";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { amountToString } from "../utils/index";
|
import { amountToString } from "../utils/index";
|
||||||
export interface Props {
|
export interface Props {
|
||||||
reservePub: string;
|
reservePub: string;
|
||||||
@ -26,6 +26,7 @@ export function ReserveCreated({
|
|||||||
exchangeBaseUrl,
|
exchangeBaseUrl,
|
||||||
amount,
|
amount,
|
||||||
}: Props): VNode {
|
}: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
const paytoURI = parsePaytoUri(payto);
|
const paytoURI = parsePaytoUri(payto);
|
||||||
if (!paytoURI) {
|
if (!paytoURI) {
|
||||||
return (
|
return (
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ExchangeListItem, i18n, Translate } from "@gnu-taler/taler-util";
|
import { ExchangeListItem } from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { Checkbox } from "../components/Checkbox";
|
import { Checkbox } from "../components/Checkbox";
|
||||||
|
import { JustInDevMode } from "../components/JustInDevMode";
|
||||||
import { SelectList } from "../components/SelectList";
|
import { SelectList } from "../components/SelectList";
|
||||||
import {
|
import {
|
||||||
DestructiveText,
|
DestructiveText,
|
||||||
@ -80,24 +81,11 @@ export function SettingsView({
|
|||||||
developerMode,
|
developerMode,
|
||||||
toggleDeveloperMode,
|
toggleDeveloperMode,
|
||||||
}: ViewProps): VNode {
|
}: ViewProps): VNode {
|
||||||
const { lang, supportedLang, changeLanguage } = useTranslationContext();
|
const { i18n, lang, supportedLang, changeLanguage } = useTranslationContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<section>
|
<section>
|
||||||
<h2>
|
|
||||||
<i18n.Translate>Display</i18n.Translate>
|
|
||||||
</h2>
|
|
||||||
<Input>
|
|
||||||
<SelectList
|
|
||||||
label={<i18n.Translate>Current Language</i18n.Translate>}
|
|
||||||
list={supportedLang}
|
|
||||||
name="lang"
|
|
||||||
value={lang}
|
|
||||||
onChange={(v) => changeLanguage(v)}
|
|
||||||
/>
|
|
||||||
</Input>
|
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
<i18n.Translate>Navigator</i18n.Translate>
|
<i18n.Translate>Navigator</i18n.Translate>
|
||||||
</h2>
|
</h2>
|
||||||
@ -206,6 +194,21 @@ export function SettingsView({
|
|||||||
enabled={developerMode}
|
enabled={developerMode}
|
||||||
onToggle={toggleDeveloperMode}
|
onToggle={toggleDeveloperMode}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<JustInDevMode>
|
||||||
|
<h2>
|
||||||
|
<i18n.Translate>Display</i18n.Translate>
|
||||||
|
</h2>
|
||||||
|
<Input>
|
||||||
|
<SelectList
|
||||||
|
label={<i18n.Translate>Current Language</i18n.Translate>}
|
||||||
|
list={supportedLang}
|
||||||
|
name="lang"
|
||||||
|
value={lang}
|
||||||
|
onChange={(v) => changeLanguage(v)}
|
||||||
|
/>
|
||||||
|
</Input>
|
||||||
|
</JustInDevMode>
|
||||||
</section>
|
</section>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
import {
|
import {
|
||||||
AmountLike,
|
AmountLike,
|
||||||
Amounts,
|
Amounts,
|
||||||
i18n,
|
|
||||||
NotificationType,
|
NotificationType,
|
||||||
parsePaytoUri,
|
parsePaytoUri,
|
||||||
Transaction,
|
Transaction,
|
||||||
@ -46,6 +45,7 @@ import {
|
|||||||
WarningBox,
|
WarningBox,
|
||||||
} from "../components/styled";
|
} from "../components/styled";
|
||||||
import { Time } from "../components/Time";
|
import { Time } from "../components/Time";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
|
||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
|
|
||||||
@ -54,6 +54,7 @@ interface Props {
|
|||||||
goToWalletHistory: (currency?: string) => void;
|
goToWalletHistory: (currency?: string) => void;
|
||||||
}
|
}
|
||||||
export function TransactionPage({ tid, goToWalletHistory }: Props): VNode {
|
export function TransactionPage({ tid, goToWalletHistory }: Props): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
async function getTransaction(): Promise<Transaction> {
|
async function getTransaction(): Promise<Transaction> {
|
||||||
const res = await wxApi.getTransactions();
|
const res = await wxApi.getTransactions();
|
||||||
const ts = res.transactions.filter((t) => t.transactionId === tid);
|
const ts = res.transactions.filter((t) => t.transactionId === tid);
|
||||||
@ -127,6 +128,8 @@ export function TransactionView({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
|
|
||||||
function TransactionTemplate({
|
function TransactionTemplate({
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
|
@ -20,10 +20,11 @@
|
|||||||
* @author sebasjm
|
* @author sebasjm
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n, WalletDiagnostics } from "@gnu-taler/taler-util";
|
import { WalletDiagnostics } from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { Checkbox } from "../components/Checkbox";
|
import { Checkbox } from "../components/Checkbox";
|
||||||
import { Diagnostics } from "../components/Diagnostics";
|
import { Diagnostics } from "../components/Diagnostics";
|
||||||
|
import { useTranslationContext } from "../context/translation";
|
||||||
import { useDiagnostics } from "../hooks/useDiagnostics";
|
import { useDiagnostics } from "../hooks/useDiagnostics";
|
||||||
import { useExtendedPermissions } from "../hooks/useExtendedPermissions";
|
import { useExtendedPermissions } from "../hooks/useExtendedPermissions";
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ export function View({
|
|||||||
diagnostics,
|
diagnostics,
|
||||||
timedOut,
|
timedOut,
|
||||||
}: ViewProps): VNode {
|
}: ViewProps): VNode {
|
||||||
|
const { i18n } = useTranslationContext();
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<h1>
|
<h1>
|
||||||
|
Loading…
Reference in New Issue
Block a user