mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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 { PageContainerFooter } from '../../ui/page-container';
|
||||||
import EditGasPopover from '../edit-gas-popover';
|
import EditGasPopover from '../edit-gas-popover';
|
||||||
import { EDIT_GAS_MODES } from '../../../../shared/constants/gas';
|
import { EDIT_GAS_MODES } from '../../../../shared/constants/gas';
|
||||||
|
import ErrorMessage from '../../ui/error-message';
|
||||||
import Dialog from '../../ui/dialog';
|
import Dialog from '../../ui/dialog';
|
||||||
import {
|
import {
|
||||||
ConfirmPageContainerHeader,
|
ConfirmPageContainerHeader,
|
||||||
@ -124,6 +125,9 @@ export default class ConfirmPageContainer extends Component {
|
|||||||
const showAddToAddressDialog =
|
const showAddToAddressDialog =
|
||||||
!contact.name && toAddress && !isOwnedAccount && !hideSenderToRecipient;
|
!contact.name && toAddress && !isOwnedAccount && !hideSenderToRecipient;
|
||||||
|
|
||||||
|
const shouldDisplayWarning =
|
||||||
|
contentComponent && disabled && (errorKey || errorMessage);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="page-container">
|
<div className="page-container">
|
||||||
<ConfirmPageContainerNavigation
|
<ConfirmPageContainerNavigation
|
||||||
@ -192,6 +196,11 @@ export default class ConfirmPageContainer extends Component {
|
|||||||
ethGasPriceWarning={ethGasPriceWarning}
|
ethGasPriceWarning={ethGasPriceWarning}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{shouldDisplayWarning && (
|
||||||
|
<div className="confirm-approve-content__warning">
|
||||||
|
<ErrorMessage errorKey={errorKey} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{contentComponent && (
|
{contentComponent && (
|
||||||
<PageContainerFooter
|
<PageContainerFooter
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
|
||||||
|
&__warning {
|
||||||
|
padding: 0 24px 16px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
&__icon-display-content {
|
&__icon-display-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 51px;
|
height: 51px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user