From eef2d4702019b9de64efc01fff097b437e65ce39 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 26 Aug 2022 01:08:51 -0300 Subject: exchange selection: timeline done --- .../src/wallet/ExchangeSelection.tsx | 282 --------------------- 1 file changed, 282 deletions(-) delete mode 100644 packages/taler-wallet-webextension/src/wallet/ExchangeSelection.tsx (limited to 'packages/taler-wallet-webextension/src/wallet/ExchangeSelection.tsx') diff --git a/packages/taler-wallet-webextension/src/wallet/ExchangeSelection.tsx b/packages/taler-wallet-webextension/src/wallet/ExchangeSelection.tsx deleted file mode 100644 index 1fa921429..000000000 --- a/packages/taler-wallet-webextension/src/wallet/ExchangeSelection.tsx +++ /dev/null @@ -1,282 +0,0 @@ -/* - 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 { - AbsoluteTime, - ExchangeListItem, - TalerProtocolTimestamp, -} from "@gnu-taler/taler-util"; -import { styled } from "@linaria/react"; -import { Fragment, h, VNode } from "preact"; -import { useState } from "preact/hooks"; -import { Loading } from "../components/Loading.js"; -import { LoadingError } from "../components/LoadingError.js"; -import { SelectList } from "../components/SelectList.js"; -import { Input, LinkPrimary } from "../components/styled/index.js"; -import { Time } from "../components/Time.js"; -import { useTranslationContext } from "../context/translation.js"; -import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js"; -import { Button } from "../mui/Button.js"; -import * as wxApi from "../wxApi.js"; - -const Container = styled.div` - display: flex; - flex-direction: column; - & > * { - margin-bottom: 20px; - } -`; - -interface Props { - initialValue?: number; - exchanges: ExchangeListItem[]; - onSelected: (exchange: string) => void; -} - -const ButtonGroup = styled.div` - & > button { - margin-left: 8px; - margin-right: 8px; - } -`; - -export function ExchangeSelection(): VNode { - const hook = useAsyncAsHook(wxApi.listExchanges); - const { i18n } = useTranslationContext(); - if (!hook) { - return ; - } - if (hook.hasError) { - return ( - Could not load list of exchange} - /> - ); - } - return ( - alert(`ok, selected: ${exchange}`)} - /> - ); -} - -export function ExchangeSelectionView({ - initialValue, - exchanges, - onSelected, -}: Props): VNode { - const list: Record = {}; - exchanges.forEach((e, i) => (list[String(i)] = e.exchangeBaseUrl)); - - const [value, setValue] = useState(String(initialValue || 0)); - const { i18n } = useTranslationContext(); - - if (!exchanges.length) { - return
no exchanges for listing, please add one
; - } - - const current = exchanges[Number(value)]; - - const hasChange = value !== current.exchangeBaseUrl; - - function nearestTimestamp( - first: TalerProtocolTimestamp, - second: TalerProtocolTimestamp, - ): TalerProtocolTimestamp { - const f = AbsoluteTime.fromTimestamp(first); - const s = AbsoluteTime.fromTimestamp(second); - const a = AbsoluteTime.min(f, s); - return AbsoluteTime.toTimestamp(a); - } - - let nextFeeUpdate = TalerProtocolTimestamp.never(); - - nextFeeUpdate = Object.values(current.wireInfo.feesForType).reduce( - (prev, cur) => { - return cur.reduce((p, c) => nearestTimestamp(p, c.endStamp), prev); - }, - nextFeeUpdate, - ); - - nextFeeUpdate = current.denominations.reduce((prev, cur) => { - return [ - cur.stampExpireWithdraw, - cur.stampExpireLegal, - cur.stampExpireDeposit, - ].reduce(nearestTimestamp, prev); - }, nextFeeUpdate); - - return ( - -

- Service fee description -

- -
-
-

- - Known exchanges} - list={list} - name="lang" - value={value} - onChange={(v) => setValue(v)} - /> - -

- {hasChange ? ( - - - - - ) : ( - - )} -
-
-
-
-
Auditors
- {current.auditors.map((a) => { -
{a.auditor_url}
; - })} -
- - - - - - - - - -
currency{current.currency}
next fee update - { -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Denomination operationsCurrent fee
deposit (i)
* 100.1
* 50.05
* 10.01
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Wallet operationsCurrent fee
history(i) 0.1
kyc (i) 0.1
account (i) 0.1
purse (i) 0.1
wire SEPA (i) 0.1
closing SEPA(i) 0.1
wad SEPA (i) 0.1
-
-
- - Privacy policy - Terms of service - -
-
- ); -} -- cgit v1.2.3