From 004b1544f394ee9dbbd0687d98933932b017f979 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 14 Aug 2022 10:10:37 -0300 Subject: get send money skeleton --- .../src/NavigationBar.tsx | 6 +++ .../src/cta/Payment/views.tsx | 4 +- .../src/cta/Refund/views.tsx | 2 +- .../src/cta/Withdraw/views.tsx | 2 +- .../src/popup/BalancePage.tsx | 10 +--- .../src/popup/NoBalanceHelp.tsx | 2 +- .../src/wallet/Application.tsx | 16 +++++- .../src/wallet/DestinationSelection.stories.tsx | 37 +++++++++++++ .../src/wallet/DestinationSelection.tsx | 60 ++++++++++++++++++++++ .../src/wallet/History.tsx | 4 +- .../src/wallet/index.stories.tsx | 2 + 11 files changed, 128 insertions(+), 17 deletions(-) create mode 100644 packages/taler-wallet-webextension/src/wallet/DestinationSelection.stories.tsx create mode 100644 packages/taler-wallet-webextension/src/wallet/DestinationSelection.tsx (limited to 'packages/taler-wallet-webextension') diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx b/packages/taler-wallet-webextension/src/NavigationBar.tsx index edcf44d35..10b901162 100644 --- a/packages/taler-wallet-webextension/src/NavigationBar.tsx +++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx @@ -94,6 +94,12 @@ export const Pages = { balanceTransaction: pageDefinition<{ tid: string }>( "/balance/transaction/:tid", ), + sendCash: pageDefinition<{ currency?: string }>( + "/destination/send/:currency?", + ), + receiveCash: pageDefinition<{ currency?: string }>( + "/destination/get/:currency?", + ), dev: "/dev", backup: "/backup", diff --git a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx index d18dc7065..bf5f4209b 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx @@ -358,7 +358,7 @@ function ButtonsSection({ onClick={state.payHandler.onClick} > - Send   + Pay   {} @@ -395,7 +395,7 @@ function ButtonsSection({ color="success" onClick={() => goToWalletManualWithdraw(state.amount.currency)} > - Withdraw digital cash + Get digital cash diff --git a/packages/taler-wallet-webextension/src/cta/Refund/views.tsx b/packages/taler-wallet-webextension/src/cta/Refund/views.tsx index 3a8148e99..d8c67334c 100644 --- a/packages/taler-wallet-webextension/src/cta/Refund/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/Refund/views.tsx @@ -169,7 +169,7 @@ export function ReadyView(state: State.Ready): VNode { onClick={state.accept.onClick} > - Receive   + Accept   diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx index 6ca8f888f..380a5903f 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx @@ -172,7 +172,7 @@ export function SuccessView(state: State.Success): VNode { onClick={state.doWithdrawal.onClick} > - Receive   + Withdraw   )} diff --git a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx index 3275a0a07..ee484afbc 100644 --- a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx +++ b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx @@ -18,7 +18,6 @@ import { Amounts, Balance, NotificationType } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; import { BalanceTable } from "../components/BalanceTable.js"; -import { JustInDevMode } from "../components/JustInDevMode.js"; import { Loading } from "../components/Loading.js"; import { LoadingError } from "../components/LoadingError.js"; import { MultiActionButton } from "../components/MultiActionButton.js"; @@ -173,20 +172,15 @@ export function BalanceView(state: State.Balances): VNode { variant="contained" onClick={state.goToWalletManualWithdraw.onClick} > - Withdraw + Get {currencyWithNonZeroAmount.length > 0 && ( Deposit {s}} + label={(s) => Send {s}} actions={currencyWithNonZeroAmount} onClick={(c) => state.goToWalletDeposit(c)} /> )} - - - ); diff --git a/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx b/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx index d9b960748..08479c73c 100644 --- a/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx +++ b/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx @@ -40,7 +40,7 @@ export function NoBalanceHelp({ variant="outlined" onClick={goToWalletManualWithdraw.onClick} > - Withdraw + Get digital cash diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx b/packages/taler-wallet-webextension/src/wallet/Application.tsx index f559e54db..a13094646 100644 --- a/packages/taler-wallet-webextension/src/wallet/Application.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx @@ -53,6 +53,10 @@ import { TransactionPage } from "./Transaction.js"; import { WelcomePage } from "./Welcome.js"; import { QrReaderPage } from "./QrReader.js"; import { platform } from "../platform/api.js"; +import { + DestinationSelectionGetCash, + DestinationSelectionSendCash, +} from "./DestinationSelection.js"; export function Application(): VNode { const [globalNotification, setGlobalNotification] = useState< @@ -126,12 +130,20 @@ export function Application(): VNode { path={Pages.balanceHistory.pattern} component={HistoryPage} goToWalletDeposit={(currency: string) => - redirectTo(Pages.balanceDeposit({ currency })) + redirectTo(Pages.sendCash({ currency })) } goToWalletManualWithdraw={(currency?: string) => - redirectTo(Pages.balanceManualWithdraw({ currency })) + redirectTo(Pages.receiveCash({ currency })) } /> + + + */ + +/** + * + * @author Sebastian Javier Marchano (sebasjm) + */ + +import { createExample } from "../test-utils.js"; +import { + DestinationSelectionGetCash, + DestinationSelectionSendCash, +} from "./DestinationSelection.js"; + +export default { + title: "wallet/destination", +}; + +export const GetCash = createExample(DestinationSelectionGetCash, { + currency: "usd", +}); +export const SendCash = createExample(DestinationSelectionSendCash, { + currency: "eur", +}); diff --git a/packages/taler-wallet-webextension/src/wallet/DestinationSelection.tsx b/packages/taler-wallet-webextension/src/wallet/DestinationSelection.tsx new file mode 100644 index 000000000..187a2412f --- /dev/null +++ b/packages/taler-wallet-webextension/src/wallet/DestinationSelection.tsx @@ -0,0 +1,60 @@ +/* + 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 { styled } from "@linaria/react"; +import { Fragment, h, VNode } from "preact"; +import { Paper } from "../mui/Paper.js"; + +const QrVideo = styled.video` + width: 80%; + margin-left: auto; + margin-right: auto; + padding: 8px; + background-color: black; +`; + +const Container = styled.div` + display: flex; + flex-direction: column; + & > * { + margin: 8px; + } +`; + +interface Props { + action: "send" | "get"; + currency?: string; +} + +export function DestinationSelectionGetCash({ currency }: Props): VNode { + return ( + +

Request {currency} from:

+ Bank account + Another person +
+ ); +} + +export function DestinationSelectionSendCash({ currency }: Props): VNode { + return ( + +

Sending {currency} to:

+ Bank account + Another person +
+ ); +} diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx index e40c1ac5b..f331cc457 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -210,7 +210,7 @@ export function HistoryView({ // style={{ marginLeft: 0, marginTop: 8 }} onClick={() => goToWalletManualWithdraw(selectedCurrency)} > - Withdraw + Get {currencyAmount && Amounts.isNonZero(currencyAmount) && ( )} diff --git a/packages/taler-wallet-webextension/src/wallet/index.stories.tsx b/packages/taler-wallet-webextension/src/wallet/index.stories.tsx index fc09ea541..25537691d 100644 --- a/packages/taler-wallet-webextension/src/wallet/index.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/index.stories.tsx @@ -35,6 +35,7 @@ import * as a14 from "./Welcome.stories.js"; import * as a15 from "./AddNewActionView.stories.js"; import * as a16 from "./DeveloperPage.stories.js"; import * as a17 from "./QrReader.stories.js"; +import * as a18 from "./DestinationSelection.stories.js"; export default [ a1, @@ -53,4 +54,5 @@ export default [ a15, a16, a17, + a18, ]; -- cgit v1.2.3