Fix amount max button.

feature/default_network_editable
Dan 7 years ago
parent 5529ec6efd
commit 41b609ab5b
  1. 4
      ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js
  2. 4
      ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.container.js
  3. 2
      ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.utils.js
  4. 2
      ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js
  5. 2
      ui/app/components/send_/send-content/send-row-wrapper/send-row-wrapper.component.js

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