From 2f13a97d00858e90ca264bd7f2667736812a27ef Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Mon, 25 Mar 2019 13:55:23 -0230 Subject: [PATCH] Cancel error rebased (#6341) * Check balance before showing cancel * Fix linter * Use existing helper methods for calculating increased cancel price * Add tooltip for disabled button * Lint fix for cancelError branch. * Disabling of cancel button should account for value of tx. --- app/_locales/en/messages.json | 3 + ...transaction-list-item-details.component.js | 58 +++++++++++++++---- .../transaction-list-item.component.js | 3 + .../transaction-list-item.container.js | 24 ++++++-- 4 files changed, 72 insertions(+), 16 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index ca6761183..eab243b8a 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -989,6 +989,9 @@ "noTransactions": { "message": "You have no transactions" }, + "notEnoughGas": { + "message": "Not Enough Gas" + }, "notFound": { "message": "Not Found" }, diff --git a/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js b/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js index b08e0bbe3..4a3b04998 100644 --- a/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js +++ b/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js @@ -20,11 +20,13 @@ export default class TransactionListItemDetails extends PureComponent { onRetry: PropTypes.func, showCancel: PropTypes.bool, showRetry: PropTypes.bool, + cancelDisabled: PropTypes.bool, transactionGroup: PropTypes.object, } state = { justCopied: false, + cancelDisabled: false, } handleEtherscanClick = () => { @@ -78,10 +80,52 @@ export default class TransactionListItemDetails extends PureComponent { }) } + renderCancel () { + const { t } = this.context + const { + showCancel, + cancelDisabled, + } = this.props + + if (!showCancel) { + return null + } + + return cancelDisabled + ? ( + +
+ +
+
+ ) + : ( + + ) + } + render () { const { t } = this.context const { justCopied } = this.state - const { transactionGroup, showCancel, showRetry, onCancel, onRetry } = this.props + const { + transactionGroup, + showRetry, + onCancel, + onRetry, + } = this.props const { primaryTransaction: transaction } = transactionGroup const { txParams: { to, from } = {} } = transaction @@ -101,17 +145,7 @@ export default class TransactionListItemDetails extends PureComponent { ) } - { - showCancel && ( - - ) - } + { this.renderCancel() }