get send money skeleton
This commit is contained in:
parent
9bb9d149d2
commit
004b1544f3
@ -94,6 +94,12 @@ export const Pages = {
|
|||||||
balanceTransaction: pageDefinition<{ tid: string }>(
|
balanceTransaction: pageDefinition<{ tid: string }>(
|
||||||
"/balance/transaction/:tid",
|
"/balance/transaction/:tid",
|
||||||
),
|
),
|
||||||
|
sendCash: pageDefinition<{ currency?: string }>(
|
||||||
|
"/destination/send/:currency?",
|
||||||
|
),
|
||||||
|
receiveCash: pageDefinition<{ currency?: string }>(
|
||||||
|
"/destination/get/:currency?",
|
||||||
|
),
|
||||||
dev: "/dev",
|
dev: "/dev",
|
||||||
|
|
||||||
backup: "/backup",
|
backup: "/backup",
|
||||||
|
@ -358,7 +358,7 @@ function ButtonsSection({
|
|||||||
onClick={state.payHandler.onClick}
|
onClick={state.payHandler.onClick}
|
||||||
>
|
>
|
||||||
<i18n.Translate>
|
<i18n.Translate>
|
||||||
Send
|
Pay
|
||||||
{<Amount value={state.payStatus.amountEffective} />}
|
{<Amount value={state.payStatus.amountEffective} />}
|
||||||
</i18n.Translate>
|
</i18n.Translate>
|
||||||
</Button>
|
</Button>
|
||||||
@ -395,7 +395,7 @@ function ButtonsSection({
|
|||||||
color="success"
|
color="success"
|
||||||
onClick={() => goToWalletManualWithdraw(state.amount.currency)}
|
onClick={() => goToWalletManualWithdraw(state.amount.currency)}
|
||||||
>
|
>
|
||||||
<i18n.Translate>Withdraw digital cash</i18n.Translate>
|
<i18n.Translate>Get digital cash</i18n.Translate>
|
||||||
</Button>
|
</Button>
|
||||||
</section>
|
</section>
|
||||||
<PayWithMobile state={state} />
|
<PayWithMobile state={state} />
|
||||||
|
@ -169,7 +169,7 @@ export function ReadyView(state: State.Ready): VNode {
|
|||||||
onClick={state.accept.onClick}
|
onClick={state.accept.onClick}
|
||||||
>
|
>
|
||||||
<i18n.Translate>
|
<i18n.Translate>
|
||||||
Receive <Amount value={state.amount} />
|
Accept <Amount value={state.amount} />
|
||||||
</i18n.Translate>
|
</i18n.Translate>
|
||||||
</Button>
|
</Button>
|
||||||
</section>
|
</section>
|
||||||
|
@ -172,7 +172,7 @@ export function SuccessView(state: State.Success): VNode {
|
|||||||
onClick={state.doWithdrawal.onClick}
|
onClick={state.doWithdrawal.onClick}
|
||||||
>
|
>
|
||||||
<i18n.Translate>
|
<i18n.Translate>
|
||||||
Receive <Amount value={state.toBeReceived} />
|
Withdraw <Amount value={state.toBeReceived} />
|
||||||
</i18n.Translate>
|
</i18n.Translate>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
@ -18,7 +18,6 @@ import { Amounts, Balance, NotificationType } from "@gnu-taler/taler-util";
|
|||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { useEffect, useState } from "preact/hooks";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
import { BalanceTable } from "../components/BalanceTable.js";
|
import { BalanceTable } from "../components/BalanceTable.js";
|
||||||
import { JustInDevMode } from "../components/JustInDevMode.js";
|
|
||||||
import { Loading } from "../components/Loading.js";
|
import { Loading } from "../components/Loading.js";
|
||||||
import { LoadingError } from "../components/LoadingError.js";
|
import { LoadingError } from "../components/LoadingError.js";
|
||||||
import { MultiActionButton } from "../components/MultiActionButton.js";
|
import { MultiActionButton } from "../components/MultiActionButton.js";
|
||||||
@ -173,20 +172,15 @@ export function BalanceView(state: State.Balances): VNode {
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={state.goToWalletManualWithdraw.onClick}
|
onClick={state.goToWalletManualWithdraw.onClick}
|
||||||
>
|
>
|
||||||
<i18n.Translate>Withdraw</i18n.Translate>
|
<i18n.Translate>Get</i18n.Translate>
|
||||||
</Button>
|
</Button>
|
||||||
{currencyWithNonZeroAmount.length > 0 && (
|
{currencyWithNonZeroAmount.length > 0 && (
|
||||||
<MultiActionButton
|
<MultiActionButton
|
||||||
label={(s) => <i18n.Translate>Deposit {s}</i18n.Translate>}
|
label={(s) => <i18n.Translate>Send {s}</i18n.Translate>}
|
||||||
actions={currencyWithNonZeroAmount}
|
actions={currencyWithNonZeroAmount}
|
||||||
onClick={(c) => state.goToWalletDeposit(c)}
|
onClick={(c) => state.goToWalletDeposit(c)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<JustInDevMode>
|
|
||||||
<Button onClick={state.addAction.onClick}>
|
|
||||||
<i18n.Translate>Enter URI</i18n.Translate>
|
|
||||||
</Button>
|
|
||||||
</JustInDevMode>
|
|
||||||
</footer>
|
</footer>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
@ -40,7 +40,7 @@ export function NoBalanceHelp({
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={goToWalletManualWithdraw.onClick}
|
onClick={goToWalletManualWithdraw.onClick}
|
||||||
>
|
>
|
||||||
<Typography>Withdraw</Typography>
|
<Typography>Get digital cash</Typography>
|
||||||
</Button>
|
</Button>
|
||||||
</Alert>
|
</Alert>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
@ -53,6 +53,10 @@ import { TransactionPage } from "./Transaction.js";
|
|||||||
import { WelcomePage } from "./Welcome.js";
|
import { WelcomePage } from "./Welcome.js";
|
||||||
import { QrReaderPage } from "./QrReader.js";
|
import { QrReaderPage } from "./QrReader.js";
|
||||||
import { platform } from "../platform/api.js";
|
import { platform } from "../platform/api.js";
|
||||||
|
import {
|
||||||
|
DestinationSelectionGetCash,
|
||||||
|
DestinationSelectionSendCash,
|
||||||
|
} from "./DestinationSelection.js";
|
||||||
|
|
||||||
export function Application(): VNode {
|
export function Application(): VNode {
|
||||||
const [globalNotification, setGlobalNotification] = useState<
|
const [globalNotification, setGlobalNotification] = useState<
|
||||||
@ -126,12 +130,20 @@ export function Application(): VNode {
|
|||||||
path={Pages.balanceHistory.pattern}
|
path={Pages.balanceHistory.pattern}
|
||||||
component={HistoryPage}
|
component={HistoryPage}
|
||||||
goToWalletDeposit={(currency: string) =>
|
goToWalletDeposit={(currency: string) =>
|
||||||
redirectTo(Pages.balanceDeposit({ currency }))
|
redirectTo(Pages.sendCash({ currency }))
|
||||||
}
|
}
|
||||||
goToWalletManualWithdraw={(currency?: string) =>
|
goToWalletManualWithdraw={(currency?: string) =>
|
||||||
redirectTo(Pages.balanceManualWithdraw({ currency }))
|
redirectTo(Pages.receiveCash({ currency }))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path={Pages.sendCash.pattern}
|
||||||
|
component={DestinationSelectionSendCash}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={Pages.receiveCash.pattern}
|
||||||
|
component={DestinationSelectionGetCash}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={Pages.balanceTransaction.pattern}
|
path={Pages.balanceTransaction.pattern}
|
||||||
component={TransactionPage}
|
component={TransactionPage}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
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 <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @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",
|
||||||
|
});
|
@ -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 <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<Container>
|
||||||
|
<p>Request {currency} from:</p>
|
||||||
|
<Paper style={{ padding: 8 }}>Bank account</Paper>
|
||||||
|
<Paper style={{ padding: 8 }}>Another person</Paper>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DestinationSelectionSendCash({ currency }: Props): VNode {
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<p>Sending {currency} to:</p>
|
||||||
|
<Paper style={{ padding: 8 }}>Bank account</Paper>
|
||||||
|
<Paper style={{ padding: 8 }}>Another person</Paper>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
@ -210,7 +210,7 @@ export function HistoryView({
|
|||||||
// style={{ marginLeft: 0, marginTop: 8 }}
|
// style={{ marginLeft: 0, marginTop: 8 }}
|
||||||
onClick={() => goToWalletManualWithdraw(selectedCurrency)}
|
onClick={() => goToWalletManualWithdraw(selectedCurrency)}
|
||||||
>
|
>
|
||||||
<i18n.Translate>Withdraw</i18n.Translate>
|
<i18n.Translate>Get</i18n.Translate>
|
||||||
</Button>
|
</Button>
|
||||||
{currencyAmount && Amounts.isNonZero(currencyAmount) && (
|
{currencyAmount && Amounts.isNonZero(currencyAmount) && (
|
||||||
<Button
|
<Button
|
||||||
@ -219,7 +219,7 @@ export function HistoryView({
|
|||||||
// style={{ marginLeft: 0, marginTop: 8 }}
|
// style={{ marginLeft: 0, marginTop: 8 }}
|
||||||
onClick={() => goToWalletDeposit(selectedCurrency)}
|
onClick={() => goToWalletDeposit(selectedCurrency)}
|
||||||
>
|
>
|
||||||
<i18n.Translate>Deposit</i18n.Translate>
|
<i18n.Translate>Send</i18n.Translate>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -35,6 +35,7 @@ import * as a14 from "./Welcome.stories.js";
|
|||||||
import * as a15 from "./AddNewActionView.stories.js";
|
import * as a15 from "./AddNewActionView.stories.js";
|
||||||
import * as a16 from "./DeveloperPage.stories.js";
|
import * as a16 from "./DeveloperPage.stories.js";
|
||||||
import * as a17 from "./QrReader.stories.js";
|
import * as a17 from "./QrReader.stories.js";
|
||||||
|
import * as a18 from "./DestinationSelection.stories.js";
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
a1,
|
a1,
|
||||||
@ -53,4 +54,5 @@ export default [
|
|||||||
a15,
|
a15,
|
||||||
a16,
|
a16,
|
||||||
a17,
|
a17,
|
||||||
|
a18,
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user