From 74dba9506dba104d918c5386e67146f71f07436c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Mar 2023 15:14:02 -0300 Subject: show wire details when the deposit has been wired --- .../src/components/TransactionItem.tsx | 54 ++++++++++++++--- .../src/wallet/Transaction.tsx | 68 +++++++++++++++++++--- 2 files changed, 106 insertions(+), 16 deletions(-) (limited to 'packages/taler-wallet-webextension/src') diff --git a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx index 934a0fe52..7ddaee9f3 100644 --- a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx +++ b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx @@ -76,7 +76,11 @@ export function TransactionItem(props: { tx: Transaction }): VNode { subtitle={tx.info.summary} timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)} iconPath={"P"} - // pending={tx.pending} + pending={ + tx.extendedStatus === ExtendedStatus.Pending + ? i18n.str`Payment in progress` + : undefined + } /> ); case TransactionType.Refund: @@ -89,7 +93,11 @@ export function TransactionItem(props: { tx: Transaction }): VNode { title={tx.info.merchant.name} timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)} iconPath={"R"} - // pending={tx.pending} + pending={ + tx.extendedStatus === ExtendedStatus.Pending + ? i18n.str`Executing refund...` + : undefined + } /> ); case TransactionType.Tip: @@ -101,7 +109,11 @@ export function TransactionItem(props: { tx: Transaction }): VNode { title={new URL(tx.merchantBaseUrl).hostname} timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)} iconPath={"T"} - // pending={tx.pending} + pending={ + tx.extendedStatus === ExtendedStatus.Pending + ? i18n.str`Grabbing the tipping...` + : undefined + } /> ); case TransactionType.Refresh: @@ -113,7 +125,11 @@ export function TransactionItem(props: { tx: Transaction }): VNode { title={"Refresh"} timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)} iconPath={"R"} - // pending={tx.pending} + pending={ + tx.extendedStatus === ExtendedStatus.Pending + ? i18n.str`Refreshing coins...` + : undefined + } /> ); case TransactionType.Deposit: @@ -125,7 +141,11 @@ export function TransactionItem(props: { tx: Transaction }): VNode { title={tx.targetPaytoUri} timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)} iconPath={"D"} - // pending={tx.pending} + pending={ + tx.extendedStatus === ExtendedStatus.Pending + ? i18n.str`Deposit in progress` + : undefined + } /> ); case TransactionType.PeerPullCredit: @@ -137,7 +157,11 @@ export function TransactionItem(props: { tx: Transaction }): VNode { title={tx.info.summary || "Invoice"} timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)} iconPath={"I"} - // pending={tx.pending} + pending={ + tx.extendedStatus === ExtendedStatus.Pending + ? i18n.str`Waiting to be paid` + : undefined + } /> ); case TransactionType.PeerPullDebit: @@ -149,7 +173,11 @@ export function TransactionItem(props: { tx: Transaction }): VNode { title={tx.info.summary || "Invoice"} timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)} iconPath={"I"} - // pending={tx.pending} + pending={ + tx.extendedStatus === ExtendedStatus.Pending + ? i18n.str`Payment in progress` + : undefined + } /> ); case TransactionType.PeerPushCredit: @@ -161,7 +189,11 @@ export function TransactionItem(props: { tx: Transaction }): VNode { title={tx.info.summary || "Transfer"} timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)} iconPath={"T"} - // pending={tx.pending} + pending={ + tx.extendedStatus === ExtendedStatus.Pending + ? i18n.str`Receiving the transfer` + : undefined + } /> ); case TransactionType.PeerPushDebit: @@ -173,7 +205,11 @@ export function TransactionItem(props: { tx: Transaction }): VNode { title={tx.info.summary || "Transfer"} timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)} iconPath={"T"} - // pending={tx.pending} + pending={ + tx.extendedStatus === ExtendedStatus.Pending + ? i18n.str`Waiting to be received` + : undefined + } /> ); default: { diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index 217a77575..a9683f680 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -28,6 +28,7 @@ import { stringifyPaytoUri, TalerProtocolTimestamp, Transaction, + TransactionDeposit, TransactionType, TranslatedString, WithdrawalType, @@ -714,13 +715,24 @@ export function TransactionView({ }} /> ) : transaction.wireTransferProgress === 100 ? ( - + + + + } + kind="neutral" + /> + ) : ( { + const am = Amounts.parseOrThrow(cur.amountEffective); + const sum = !prev[cur.wireTransferId] + ? am + : Amounts.add(prev[cur.wireTransferId], am).amount; + prev[cur.wireTransferId] = sum; + return prev; + }, {} as Record); + const wireTransfers = Object.entries(trackByWtid).map(([id, amountJson]) => ({ + id, + amount: Amounts.stringify(amountJson), + })); + + return ( + + + + Transfer identification + + + Amount + + + + {wireTransfers.map((wire) => ( + + {wire.id} + + + + + ))} + + ); +} function DepositDetails({ amount }: { amount: AmountWithFee }): VNode { const { i18n } = useTranslationContext(); -- cgit v1.2.3