diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/Transaction.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/Transaction.tsx | 38 |
1 files changed, 22 insertions, 16 deletions
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 ( <Fragment> <section style={{ padding: 8, textAlign: "center" }}> @@ -353,13 +357,15 @@ function TransactionTemplate({ </Button> ) : null} {transactionStillActive ? ( - <Button - variant="contained" - color="error" - onClick={doCheckBeforeCancel as SafeHandler<void>} - > - <i18n.Translate>Cancel</i18n.Translate> - </Button> + hasCancelTransactionImplemented ? ( + <Button + variant="contained" + color="error" + onClick={doCheckBeforeCancel as SafeHandler<void>} + > + <i18n.Translate>Cancel</i18n.Translate> + </Button> + ) : undefined ) : ( <Button variant="contained" |