1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

Warn the user of insufficient funds when approving a token (#12496)

* Warn the user of insufficient funds (ETH for gas) when approving a token

* Fixing code lines while run yarn lint:fix

* Fixing test-e2e-chrome

* Fixing e2e tests

* Create shouldDisplayWarning variable
This commit is contained in:
VSaric 2021-11-03 16:13:31 +01:00 committed by GitHub
parent 5f0fd9d1c2
commit 64e45c801d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import SenderToRecipient from '../../ui/sender-to-recipient';
import { PageContainerFooter } from '../../ui/page-container';
import EditGasPopover from '../edit-gas-popover';
import { EDIT_GAS_MODES } from '../../../../shared/constants/gas';
import ErrorMessage from '../../ui/error-message';
import Dialog from '../../ui/dialog';
import {
ConfirmPageContainerHeader,
@ -124,6 +125,9 @@ export default class ConfirmPageContainer extends Component {
const showAddToAddressDialog =
!contact.name && toAddress && !isOwnedAccount && !hideSenderToRecipient;
const shouldDisplayWarning =
contentComponent && disabled && (errorKey || errorMessage);
return (
<div className="page-container">
<ConfirmPageContainerNavigation
@ -192,6 +196,11 @@ export default class ConfirmPageContainer extends Component {
ethGasPriceWarning={ethGasPriceWarning}
/>
)}
{shouldDisplayWarning && (
<div className="confirm-approve-content__warning">
<ErrorMessage errorKey={errorKey} />
</div>
)}
{contentComponent && (
<PageContainerFooter
onCancel={onCancel}

View File

@ -5,6 +5,10 @@
width: 100%;
font-style: normal;
&__warning {
padding: 0 24px 16px 24px;
}
&__icon-display-content {
display: flex;
height: 51px;