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
feature/default_network_editable
VSaric 3 years ago committed by GitHub
parent 5f0fd9d1c2
commit 64e45c801d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      ui/components/app/confirm-page-container/confirm-page-container.component.js
  2. 4
      ui/pages/confirm-approve/confirm-approve-content/index.scss

@ -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…
Cancel
Save