diff options
author | Sebastian <sebasjm@gmail.com> | 2021-11-24 08:57:26 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2021-11-24 08:58:49 -0300 |
commit | 0bfd4523b3408d9c841a1f25fd9ec86e81d6dd8f (patch) | |
tree | f453943d92fefbd04b9222a5f25f2c9563c239f3 /packages/taler-wallet-webextension/src/wallet/Settings.tsx | |
parent | f07436aa4910114a514235fb17879411dae0a555 (diff) | |
download | wallet-core-0bfd4523b3408d9c841a1f25fd9ec86e81d6dd8f.tar.xz |
adding tos information in settings and return to manual withdraw when adding an exchange
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/Settings.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/Settings.tsx | 91 |
1 files changed, 55 insertions, 36 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.tsx b/packages/taler-wallet-webextension/src/wallet/Settings.tsx index 5f1cd89d3..04656acc1 100644 --- a/packages/taler-wallet-webextension/src/wallet/Settings.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Settings.tsx @@ -17,14 +17,19 @@ import { ExchangeListItem, i18n } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { Checkbox } from "../components/Checkbox"; -import { LinkPrimary } from "../components/styled"; +import { + DestructiveText, + LinkPrimary, + SuccessText, + WarningText, +} from "../components/styled"; import { useDevContext } from "../context/devContext"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook"; import { useBackupDeviceName } from "../hooks/useBackupDeviceName"; import { useExtendedPermissions } from "../hooks/useExtendedPermissions"; import { useLang } from "../hooks/useLang"; import { Pages } from "../NavigationBar"; -// import { strings as messages } from "../i18n/strings"; +import { buildTermsOfServiceStatus } from "../utils"; import * as wxApi from "../wxApi"; export function SettingsPage(): VNode { @@ -65,25 +70,8 @@ export interface ViewProps { knownExchanges: Array<ExchangeListItem>; } -// type LangsNames = { -// [P in keyof typeof messages]: string; -// }; - -// const names: LangsNames = { -// es: "Español [es]", -// en: "English [en]", -// fr: "Français [fr]", -// de: "Deutsch [de]", -// sv: "Svenska [sv]", -// it: "Italiano [it]", -// }; - export function SettingsView({ knownExchanges, - // lang, - // changeLang, - // deviceName, - // setDeviceName, permissionsEnabled, togglePermissions, developerMode, @@ -93,6 +81,17 @@ export function SettingsView({ <Fragment> <section> <h2> + <i18n.Translate>Permissions</i18n.Translate> + </h2> + <Checkbox + label="Automatically open wallet based on page content" + name="perm" + description="(Enabling this option below will make using the wallet faster, but requires more permissions from your browser.)" + enabled={permissionsEnabled} + onToggle={togglePermissions} + /> + + <h2> <i18n.Translate>Known exchanges</i18n.Translate> </h2> {!knownExchanges || !knownExchanges.length ? ( @@ -100,14 +99,44 @@ export function SettingsView({ ) : ( <Fragment> <table> - {knownExchanges.map((e, idx) => ( - <tr key={idx}> - <td>{e.currency}</td> - <td> - <a href={e.exchangeBaseUrl}>{e.exchangeBaseUrl}</a> - </td> + <thead> + <tr> + <th>currency</th> + <th>url</th> + <th>term of service</th> </tr> - ))} + </thead> + <tbody> + {knownExchanges.map((e, idx) => { + function Status(): VNode { + const status = buildTermsOfServiceStatus( + e.tos.content, + e.tos.acceptedVersion, + e.tos.currentVersion, + ); + switch (status) { + case "accepted": + return <SuccessText>ok</SuccessText>; + case "changed": + return <WarningText>changed!</WarningText>; + case "new": + case "notfound": + return <DestructiveText>not accepted</DestructiveText>; + } + } + return ( + <tr key={idx}> + <td>{e.currency}</td> + <td> + <a href={e.exchangeBaseUrl}>{e.exchangeBaseUrl}</a> + </td> + <td> + <Status /> + </td> + </tr> + ); + })} + </tbody> </table> </Fragment> )} @@ -116,16 +145,6 @@ export function SettingsView({ <LinkPrimary href={Pages.exchange_add}>Add an exchange</LinkPrimary> </div> - <h2> - <i18n.Translate>Permissions</i18n.Translate> - </h2> - <Checkbox - label="Automatically open wallet based on page content" - name="perm" - description="(Enabling this option below will make using the wallet faster, but requires more permissions from your browser.)" - enabled={permissionsEnabled} - onToggle={togglePermissions} - /> <h2>Config</h2> <Checkbox label="Developer mode" |