From dce055d0d3fe2037d4c3018baa360b9082e37194 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 10 Aug 2022 11:50:46 -0300 Subject: withdraw call to action --- .../src/wallet/Application.tsx | 81 +++++++++------ .../src/wallet/Transaction.tsx | 111 ++++++++++++--------- 2 files changed, 111 insertions(+), 81 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet') diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx b/packages/taler-wallet-webextension/src/wallet/Application.tsx index 603163cee..f6cef7e90 100644 --- a/packages/taler-wallet-webextension/src/wallet/Application.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx @@ -76,33 +76,34 @@ export function Application(): VNode { {/* won't work in the first render if is not called first */} {/* https://github.com/preactjs/preact-router/issues/415 */} - - - {({ path }: { path: string }) => { - if (path && path.startsWith("/cta")) return; - return ( - - - - {shouldShowPendingOperations(path) && ( -
- - redirectTo(Pages.balanceTransaction({ tid })) - } - /> -
- )} -
- ); - }} -
+ + + {({ path }: { path: string }) => { + if (path && path.startsWith("/cta")) return; + return ( + + + + {shouldShowPendingOperations(path) && ( +
+ + redirectTo(Pages.balanceTransaction({ tid })) + } + /> +
+ )} +
+ ); + }} +
+
{globalNotification && ( @@ -206,12 +207,28 @@ export function Application(): VNode { goToWalletManualWithdraw={(currency?: string) => redirectTo(Pages.balanceManualWithdraw({ currency })) } - goBack={() => redirectTo(Pages.balance)} + cancel={() => redirectTo(Pages.balance)} + /> + redirectTo(Pages.balance)} + /> + redirectTo(Pages.balance)} + /> + redirectTo(Pages.balance)} + /> + redirectTo(Pages.balance)} /> - - - - {/** * NOT FOUND diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index e643fef18..ff3b70b65 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -32,7 +32,6 @@ import { TransactionRefund, TransactionTip, TransactionType, - TransactionWithdrawal, WithdrawalType, } from "@gnu-taler/taler-util"; import { styled } from "@linaria/react"; @@ -308,7 +307,14 @@ export function TransactionView({ )} Details} - text={} + text={ + + } /> ); @@ -713,10 +719,64 @@ function DeliveryDetails({ ); } +export function ExchangeDetails({ exchange }: { exchange: string }): VNode { + return ( + + ); +} + export interface AmountWithFee { effective: AmountJson; raw: AmountJson; } + +export function WithdrawDetails({ amount }: { amount: AmountWithFee }): VNode { + const { i18n } = useTranslationContext(); + + const fee = Amounts.sub(amount.raw, amount.effective).amount; + + const maxFrac = [amount.raw, amount.effective, fee] + .map((a) => Amounts.maxFractionalDigits(a)) + .reduce((c, p) => Math.max(c, p), 0); + + return ( + + + Withdraw + + + + + + {Amounts.isNonZero(fee) && ( + + Transaction fees + + + + + )} + + +
+ + + + Total + + + + +
+ ); +} + export function PurchaseDetails({ price, refund, @@ -1020,53 +1080,6 @@ function TipDetails({ transaction }: { transaction: TransactionTip }): VNode { ); } -function WithdrawDetails({ - transaction, -}: { - transaction: TransactionWithdrawal; -}): VNode { - const { i18n } = useTranslationContext(); - - const r = Amounts.parseOrThrow(transaction.amountRaw); - const e = Amounts.parseOrThrow(transaction.amountEffective); - const fee = Amounts.sub(r, e).amount; - - const maxFrac = [r, e, fee] - .map((a) => Amounts.maxFractionalDigits(a)) - .reduce((c, p) => Math.max(c, p), 0); - - return ( - - - Withdraw - - - - - - {Amounts.isNonZero(fee) && ( - - Transaction fees - - - - - )} - - -
- - - - Total - - - - -
- ); -} - function Header({ timestamp, total, -- cgit v1.2.3