From 1a63d56bfdd091cc7aefdf1e25f3a074bfdf5e0e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 16 Nov 2022 16:04:52 -0300 Subject: fix #7411, also making the backup payment visible --- .../src/wallet/AddBackupProvider/views.tsx | 172 +++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 packages/taler-wallet-webextension/src/wallet/AddBackupProvider/views.tsx (limited to 'packages/taler-wallet-webextension/src/wallet/AddBackupProvider/views.tsx') diff --git a/packages/taler-wallet-webextension/src/wallet/AddBackupProvider/views.tsx b/packages/taler-wallet-webextension/src/wallet/AddBackupProvider/views.tsx new file mode 100644 index 000000000..b633a595f --- /dev/null +++ b/packages/taler-wallet-webextension/src/wallet/AddBackupProvider/views.tsx @@ -0,0 +1,172 @@ +/* + This file is part of GNU Taler + (C) 2022 Taler Systems S.A. + + GNU 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. + + GNU 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 + GNU Taler; see the file COPYING. If not, see + */ + +import { Amounts } from "@gnu-taler/taler-util"; +import { Fragment, h, VNode } from "preact"; +import { Checkbox } from "../../components/Checkbox.js"; +import { LoadingError } from "../../components/LoadingError.js"; +import { + LightText, + SmallLightText, + SubTitle, + TermsOfService, + Title, +} from "../../components/styled/index.js"; +import { useTranslationContext } from "../../context/translation.js"; +import { Button } from "../../mui/Button.js"; +import { TextField } from "../../mui/TextField.js"; +import { State } from "./index.js"; + +export function LoadingUriView({ error }: State.LoadingUriError): VNode { + const { i18n } = useTranslationContext(); + + return ( + Could not load} + error={error} + /> + ); +} + +export function ConfirmProviderView({ + url, + provider, + tos, + onCancel, + onAccept, +}: State.ConfirmProvider): VNode { + const { i18n } = useTranslationContext(); + const noFee = Amounts.isZero(provider.annual_fee); + return ( + +
+ + <i18n.Translate>Review terms of service</i18n.Translate> + +
+ Provider URL:{" "} + + {url} + +
+ + + Please review and accept this provider's terms of service + + + + 1. Pricing + +

+ {noFee ? ( + free of charge + ) : ( + + {provider.annual_fee} per year of service + + )} +

+ + 2. Storage + +

+ + {provider.storage_limit_in_megabytes} megabytes of storage per year + of service + +

+ {/* replace with */} + Accept terms of service} + name="terms" + onToggle={tos.button.onClick} + enabled={tos.value} + /> +
+
+ + +
+
+ ); +} + +export function SelectProviderView({ + url, + name, + urlOk, + onCancel, + onConfirm, +}: State.SelectProvider): VNode { + const { i18n } = useTranslationContext(); + return ( + +
+ + <i18n.Translate>Add backup provider</i18n.Translate> + + + + Backup providers may charge for their service + + +

+ URL} + placeholder="https://" + color={urlOk ? "success" : undefined} + value={url.value} + error={url.error} + onChange={url.onInput} + /> +

+

+ Name} + placeholder="provider name" + value={name.value} + error={name.error} + onChange={name.onInput} + /> +

+
+ +
+ ); +} -- cgit v1.2.3