From 420493b3e608f3b245ebae308a318883f9f605f7 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 17 Jan 2023 16:01:04 -0300 Subject: use payto builder and prevent showing cancel for non-payment --- .../src/wallet/Transaction.tsx | 38 +++++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet/Transaction.tsx') diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index 7c0682588..397972636 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -202,20 +202,24 @@ function TransactionTemplate({ const SHOWING_RETRY_THRESHOLD_SECS = 30; const showSend = false; - // (transaction.type === TransactionType.PeerPullCredit || - // transaction.type === TransactionType.PeerPushDebit) && - // !transaction.info.completed; - const showRetry = - transaction.error !== undefined || - transaction.timestamp.t_s === "never" || - (transaction.extendedStatus === ExtendedStatus.Pending && - differenceInSeconds(new Date(), transaction.timestamp.t_s * 1000) > - SHOWING_RETRY_THRESHOLD_SECS); + const hasCancelTransactionImplemented = + transaction.type === TransactionType.Payment; const transactionStillActive = transaction.extendedStatus !== ExtendedStatus.Aborted && transaction.extendedStatus !== ExtendedStatus.Done && transaction.extendedStatus !== ExtendedStatus.Failed; + + // show retry if there is an error in an active state, or after some time + // if it is not aborting + const showRetry = + transactionStillActive && + (transaction.error !== undefined || + (transaction.extendedStatus !== ExtendedStatus.Aborting && + (transaction.timestamp.t_s === "never" || + differenceInSeconds(new Date(), transaction.timestamp.t_s * 1000) > + SHOWING_RETRY_THRESHOLD_SECS))); + return (
@@ -353,13 +357,15 @@ function TransactionTemplate({ ) : null} {transactionStillActive ? ( - + hasCancelTransactionImplemented ? ( + + ) : undefined ) : (