From 882d6b3710f82d85b2129f09c63f9db45985ef64 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 24 Jan 2022 14:12:12 -0300 Subject: last activity -> pending; fix downloadTos --- .../src/wallet/History.stories.tsx | 44 +++++++++ .../src/wallet/History.tsx | 107 ++++++++++++--------- .../src/wallet/LastActivityPage.stories.tsx | 33 ------- .../src/wallet/LastActivityPage.tsx | 35 ------- .../src/wallet/PendingPage.stories.tsx | 33 +++++++ .../src/wallet/PendingPage.tsx | 35 +++++++ 6 files changed, 174 insertions(+), 113 deletions(-) delete mode 100644 packages/taler-wallet-webextension/src/wallet/LastActivityPage.stories.tsx delete mode 100644 packages/taler-wallet-webextension/src/wallet/LastActivityPage.tsx create mode 100644 packages/taler-wallet-webextension/src/wallet/PendingPage.stories.tsx create mode 100644 packages/taler-wallet-webextension/src/wallet/PendingPage.tsx (limited to 'packages/taler-wallet-webextension/src/wallet') diff --git a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx index 3f550175d..921ac5005 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx @@ -277,3 +277,47 @@ export const FiveOfficialCurrencies = createExample(TestedComponent, { }, ], }); + +export const FiveOfficialCurrenciesWithHighValue = createExample( + TestedComponent, + { + transactions: [exampleData.withdraw], + balances: [ + { + available: "USD:881001321230000", + pendingIncoming: "USD:0", + pendingOutgoing: "USD:0", + hasPendingTransactions: false, + requiresUserInput: false, + }, + { + available: "EUR:10", + pendingIncoming: "TESTKUDOS:0", + pendingOutgoing: "TESTKUDOS:0", + hasPendingTransactions: false, + requiresUserInput: false, + }, + { + available: "COL:443000123123000.5123123", + pendingIncoming: "TESTKUDOS:0", + pendingOutgoing: "TESTKUDOS:0", + hasPendingTransactions: false, + requiresUserInput: false, + }, + { + available: "JPY:1564450000000.6123123", + pendingIncoming: "TESTKUDOS:0", + pendingOutgoing: "TESTKUDOS:0", + hasPendingTransactions: false, + requiresUserInput: false, + }, + { + available: "GBP:736001231231200.23123", + pendingIncoming: "TESTKUDOS:0", + pendingOutgoing: "TESTKUDOS:0", + hasPendingTransactions: false, + requiresUserInput: false, + }, + ], + }, +); diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx index a295ca28f..feeb61c5d 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -28,6 +28,8 @@ import { ButtonBoxPrimary, ButtonBoxWarning, ButtonPrimary, + CenteredBoldText, + CenteredText, DateSeparator, NiceSelect, WarningBox, @@ -126,8 +128,6 @@ export function HistoryView({ }, {} as { [x: string]: Transaction[] }); const datesWithTransaction = Object.keys(byDate); - const multiCurrency = balances.length > 1; - if (balances.length === 0 || !selectedCurrency) { return ( @@ -143,52 +143,73 @@ export function HistoryView({ return (
-

- {currencies.length === 1 ? ( -

{selectedCurrency}
- ) : ( - - { + setCurrencyIndex(Number(e.currentTarget.value)); + }} + > + {currencies.map((currency, index) => { + return ( + + ); + })} + + + )} + {currencyAmount && ( + - {currencies.map((currency, index) => { - return ( - - ); - })} - - - )} - {currencyAmount && ( -

- {Amounts.stringifyValue(currencyAmount)} -

- )} -

-
- goToWalletManualWithdraw(selectedCurrency)} - > - Withdraw - - {currencyAmount && Amounts.isNonZero(currencyAmount) && ( - goToWalletDeposit(selectedCurrency)} + {Amounts.stringifyValue(currencyAmount)} + + )} +
+
+ goToWalletManualWithdraw(selectedCurrency)} > - Deposit - - )} + Withdraw + + {currencyAmount && Amounts.isNonZero(currencyAmount) && ( + goToWalletDeposit(selectedCurrency)} + > + Deposit + + )} +
{datesWithTransaction.length === 0 ? ( @@ -205,11 +226,7 @@ export function HistoryView({ /> {byDate[d].map((tx, i) => ( - + ))}
); diff --git a/packages/taler-wallet-webextension/src/wallet/LastActivityPage.stories.tsx b/packages/taler-wallet-webextension/src/wallet/LastActivityPage.stories.tsx deleted file mode 100644 index e729c2982..000000000 --- a/packages/taler-wallet-webextension/src/wallet/LastActivityPage.stories.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2021 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 - */ - -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - -import { createExample } from "../test-utils"; -import { queryToSlashKeys } from "../utils/index"; -import { LastActivityPage as TestedComponent } from "./LastActivityPage"; - -export default { - title: "wallet/last activity", - component: TestedComponent, -}; - -export const InitialState = createExample(TestedComponent, { - onVerify: queryToSlashKeys, -}); diff --git a/packages/taler-wallet-webextension/src/wallet/LastActivityPage.tsx b/packages/taler-wallet-webextension/src/wallet/LastActivityPage.tsx deleted file mode 100644 index 8ec4c8759..000000000 --- a/packages/taler-wallet-webextension/src/wallet/LastActivityPage.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - This file is part of TALER - (C) 2016 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 -*/ - -import { h, VNode } from "preact"; -import { useState } from "preact/hooks"; -import { ButtonPrimary } from "../components/styled"; -import { AddNewActionView } from "./AddNewActionView"; - -export function LastActivityPage(): VNode { - const [addingAction, setAddingAction] = useState(false); - - if (addingAction) { - return setAddingAction(false)} />; - } - - return ( -
-
- setAddingAction(true)}>+ -
- ); -} diff --git a/packages/taler-wallet-webextension/src/wallet/PendingPage.stories.tsx b/packages/taler-wallet-webextension/src/wallet/PendingPage.stories.tsx new file mode 100644 index 000000000..cbcb5a824 --- /dev/null +++ b/packages/taler-wallet-webextension/src/wallet/PendingPage.stories.tsx @@ -0,0 +1,33 @@ +/* + This file is part of GNU Taler + (C) 2021 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 + */ + +/** + * + * @author Sebastian Javier Marchano (sebasjm) + */ + +import { createExample } from "../test-utils"; +import { queryToSlashKeys } from "../utils/index"; +import { Pending as TestedComponent } from "./PendingPage"; + +export default { + title: "wallet/pending", + component: TestedComponent, +}; + +export const InitialState = createExample(TestedComponent, { + onVerify: queryToSlashKeys, +}); diff --git a/packages/taler-wallet-webextension/src/wallet/PendingPage.tsx b/packages/taler-wallet-webextension/src/wallet/PendingPage.tsx new file mode 100644 index 000000000..998095238 --- /dev/null +++ b/packages/taler-wallet-webextension/src/wallet/PendingPage.tsx @@ -0,0 +1,35 @@ +/* + This file is part of TALER + (C) 2016 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 +*/ + +import { h, VNode } from "preact"; +import { useState } from "preact/hooks"; +import { ButtonPrimary } from "../components/styled"; +import { AddNewActionView } from "./AddNewActionView"; + +export function Pending(): VNode { + const [addingAction, setAddingAction] = useState(false); + + if (addingAction) { + return setAddingAction(false)} />; + } + + return ( +
+
+ setAddingAction(true)}>+ +
+ ); +} -- cgit v1.2.3