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,
|
tokenBalance: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
setAmountToMax = function () {
|
setMaxAmount () {
|
||||||
const {
|
const {
|
||||||
balance,
|
balance,
|
||||||
gasTotal,
|
gasTotal,
|
||||||
@ -39,7 +39,7 @@ export default class AmountMaxButton extends Component {
|
|||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
setMaxModeTo(true)
|
setMaxModeTo(true)
|
||||||
this.setAmountToMax()
|
this.setMaxAmount()
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!maxModeOn ? this.context.t('max') : ''}
|
{!maxModeOn ? this.context.t('max') : ''}
|
||||||
|
@ -32,8 +32,8 @@ function mapStateToProps (state) {
|
|||||||
function mapDispatchToProps (dispatch) {
|
function mapDispatchToProps (dispatch) {
|
||||||
return {
|
return {
|
||||||
setAmountToMax: maxAmountDataObject => {
|
setAmountToMax: maxAmountDataObject => {
|
||||||
updateSendErrors({ amount: null })
|
dispatch(updateSendErrors({ amount: null }))
|
||||||
updateSendAmount(calcMaxAmount(maxAmountDataObject))
|
dispatch(updateSendAmount(calcMaxAmount(maxAmountDataObject)))
|
||||||
},
|
},
|
||||||
setMaxModeTo: bool => dispatch(setMaxModeTo(bool)),
|
setMaxModeTo: bool => dispatch(setMaxModeTo(bool)),
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const {
|
const {
|
||||||
multiplyCurrencies,
|
multiplyCurrencies,
|
||||||
subtractCurrencies,
|
subtractCurrencies,
|
||||||
} = require('../../../../conversion-util')
|
} = require('../../../../../conversion-util')
|
||||||
const ethUtil = require('ethereumjs-util')
|
const ethUtil = require('ethereumjs-util')
|
||||||
|
|
||||||
function calcMaxAmount ({ balance, gasTotal, selectedToken, tokenBalance }) {
|
function calcMaxAmount ({ balance, gasTotal, selectedToken, tokenBalance }) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import SendRowWrapper from '../send-row-wrapper/send-row-wrapper.component'
|
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'
|
import CurrencyDisplay from '../../../send/currency-display'
|
||||||
|
|
||||||
export default class SendAmountRow extends Component {
|
export default class SendAmountRow extends Component {
|
||||||
|
@ -20,7 +20,7 @@ export default class SendRowWrapper extends Component {
|
|||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const formField = Array.isArray(children) ? children[1] || children[0] : children
|
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 (
|
return (
|
||||||
<div className="send-v2__form-row">
|
<div className="send-v2__form-row">
|
||||||
|
Loading…
Reference in New Issue
Block a user