mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix amount max button.
This commit is contained in:
parent
5529ec6efd
commit
41b609ab5b
@ -13,7 +13,7 @@ export default class AmountMaxButton extends Component {
|
||||
tokenBalance: PropTypes.string,
|
||||
};
|
||||
|
||||
setAmountToMax = function () {
|
||||
setMaxAmount () {
|
||||
const {
|
||||
balance,
|
||||
gasTotal,
|
||||
@ -39,7 +39,7 @@ export default class AmountMaxButton extends Component {
|
||||
onClick={(event) => {
|
||||
event.preventDefault()
|
||||
setMaxModeTo(true)
|
||||
this.setAmountToMax()
|
||||
this.setMaxAmount()
|
||||
}}
|
||||
>
|
||||
{!maxModeOn ? this.context.t('max') : ''}
|
||||
|
@ -32,8 +32,8 @@ function mapStateToProps (state) {
|
||||
function mapDispatchToProps (dispatch) {
|
||||
return {
|
||||
setAmountToMax: maxAmountDataObject => {
|
||||
updateSendErrors({ amount: null })
|
||||
updateSendAmount(calcMaxAmount(maxAmountDataObject))
|
||||
dispatch(updateSendErrors({ amount: null }))
|
||||
dispatch(updateSendAmount(calcMaxAmount(maxAmountDataObject)))
|
||||
},
|
||||
setMaxModeTo: bool => dispatch(setMaxModeTo(bool)),
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
const {
|
||||
multiplyCurrencies,
|
||||
subtractCurrencies,
|
||||
} = require('../../../../conversion-util')
|
||||
} = require('../../../../../conversion-util')
|
||||
const ethUtil = require('ethereumjs-util')
|
||||
|
||||
function calcMaxAmount ({ balance, gasTotal, selectedToken, tokenBalance }) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import SendRowWrapper from '../send-row-wrapper/send-row-wrapper.component'
|
||||
import AmountMaxButton from './amount-max-button/amount-max-button.component'
|
||||
import AmountMaxButton from './amount-max-button/amount-max-button.container'
|
||||
import CurrencyDisplay from '../../../send/currency-display'
|
||||
|
||||
export default class SendAmountRow extends Component {
|
||||
|
@ -20,7 +20,7 @@ export default class SendRowWrapper extends Component {
|
||||
} = this.props
|
||||
|
||||
const formField = Array.isArray(children) ? children[1] || children[0] : children
|
||||
const customLabelContent = children.length === 1 ? children[0] : null
|
||||
const customLabelContent = children.length > 1 ? children[0] : null
|
||||
|
||||
return (
|
||||
<div className="send-v2__form-row">
|
||||
|
Loading…
Reference in New Issue
Block a user