You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
7 years ago
|
import { connect } from 'react-redux'
|
||
7 years ago
|
import {
|
||
|
getGasTotal,
|
||
7 years ago
|
getSelectedToken,
|
||
7 years ago
|
getSendFromBalance,
|
||
7 years ago
|
getTokenBalance,
|
||
7 years ago
|
} from '../../../send.selectors.js'
|
||
7 years ago
|
import { getMaxModeOn } from './amount-max-button.selectors.js'
|
||
7 years ago
|
import { calcMaxAmount } from './amount-max-button.utils.js'
|
||
|
import {
|
||
|
updateSendAmount,
|
||
|
setMaxModeTo,
|
||
7 years ago
|
} from '../../../../../actions'
|
||
7 years ago
|
import AmountMaxButton from './amount-max-button.component'
|
||
7 years ago
|
import {
|
||
|
updateSendErrors,
|
||
7 years ago
|
} from '../../../../../ducks/send.duck'
|
||
7 years ago
|
|
||
7 years ago
|
export default connect(mapStateToProps, mapDispatchToProps)(AmountMaxButton)
|
||
7 years ago
|
|
||
|
function mapStateToProps (state) {
|
||
|
|
||
|
return {
|
||
7 years ago
|
balance: getSendFromBalance(state),
|
||
7 years ago
|
gasTotal: getGasTotal(state),
|
||
7 years ago
|
maxModeOn: getMaxModeOn(state),
|
||
|
selectedToken: getSelectedToken(state),
|
||
7 years ago
|
tokenBalance: getTokenBalance(state),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function mapDispatchToProps (dispatch) {
|
||
|
return {
|
||
|
setAmountToMax: maxAmountDataObject => {
|
||
7 years ago
|
dispatch(updateSendErrors({ amount: null }))
|
||
|
dispatch(updateSendAmount(calcMaxAmount(maxAmountDataObject)))
|
||
7 years ago
|
},
|
||
7 years ago
|
setMaxModeTo: bool => dispatch(setMaxModeTo(bool)),
|
||
|
}
|
||
7 years ago
|
}
|