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:
parent
5f0fd9d1c2
commit
64e45c801d
@ -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}
|
||||
|
@ -5,6 +5,10 @@
|
||||
width: 100%;
|
||||
font-style: normal;
|
||||
|
||||
&__warning {
|
||||
padding: 0 24px 16px 24px;
|
||||
}
|
||||
|
||||
&__icon-display-content {
|
||||
display: flex;
|
||||
height: 51px;
|
||||
|
Loading…
Reference in New Issue
Block a user