aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js
diff options
context:
space:
mode:
authorDan Miller <danjm.com@gmail.com>2018-09-13 20:35:17 +0800
committerDan Miller <danjm.com@gmail.com>2018-12-04 11:36:04 +0800
commitb567c78bcae73e9c73b69040d22e096e4f876a2b (patch)
tree0b8327736e09cd41ca978d82cd7c1108c23165a5 /ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js
parent7de3f22d63748ed5a81e947755db056d4cdef3db (diff)
downloadtangerine-wallet-browser-b567c78bcae73e9c73b69040d22e096e4f876a2b.tar.gz
tangerine-wallet-browser-b567c78bcae73e9c73b69040d22e096e4f876a2b.tar.zst
tangerine-wallet-browser-b567c78bcae73e9c73b69040d22e096e4f876a2b.zip
Integrate gas buttons with the send screen.
Diffstat (limited to 'ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js')
-rw-r--r--ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js47
1 files changed, 43 insertions, 4 deletions
diff --git a/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js b/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js
index e44fe4ef1..19e49b391 100644
--- a/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js
+++ b/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js
@@ -3,25 +3,64 @@ import {
getConversionRate,
getCurrentCurrency,
getGasTotal,
+ getGasPrice,
} from '../../send.selectors.js'
-import { getGasLoadingError, gasFeeIsInError } from './send-gas-row.selectors.js'
-import { showModal } from '../../../../actions'
+import{
+ getBasicGasEstimateLoadingStatus,
+ getRenderableEstimateDataForSmallButtons,
+ getDefaultActiveButtonIndex
+} from '../../../../selectors/custom-gas'
+import{
+ showGasButtonGroup
+} from '../../../../ducks/send.duck'
+import { getGasLoadingError, gasFeeIsInError, getGasButtonGroupShown } from './send-gas-row.selectors.js'
+import { showModal, setGasPrice } from '../../../../actions'
import SendGasRow from './send-gas-row.component'
-export default connect(mapStateToProps, mapDispatchToProps)(SendGasRow)
+export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(SendGasRow)
function mapStateToProps (state) {
+ const gasButtonInfo = getRenderableEstimateDataForSmallButtons(state)
+ const activeButtonIndex = getDefaultActiveButtonIndex(gasButtonInfo, getGasPrice(state))
+
return {
conversionRate: getConversionRate(state),
convertedCurrency: getCurrentCurrency(state),
gasTotal: getGasTotal(state),
gasFeeError: gasFeeIsInError(state),
gasLoadingError: getGasLoadingError(state),
+ gasPriceButtonGroupProps: {
+ buttonDataLoading: getBasicGasEstimateLoadingStatus(state),
+ defaultActiveButtonIndex: 1,
+ newActiveButtonIndex: activeButtonIndex > -1 ? activeButtonIndex : null,
+ gasButtonInfo,
+ },
+ gasButtonGroupShown: getGasButtonGroupShown(state),
}
}
function mapDispatchToProps (dispatch) {
return {
- showCustomizeGasModal: () => dispatch(showModal({ name: 'CUSTOMIZE_GAS' })),
+ showCustomizeGasModal: () => dispatch(showModal({ name: 'CUSTOMIZE_GAS', hideBasic: true })),
+ setGasPrice: newPrice => dispatch(setGasPrice(newPrice)),
+ showGasButtonGroup: () => dispatch(showGasButtonGroup())
}
}
+
+function mergeProps (stateProps, dispatchProps, ownProps) {
+ const { gasPriceButtonGroupProps } = stateProps
+ const {
+ setGasPrice: dispatchSetGasPrice,
+ ...otherDispatchProps
+ } = dispatchProps
+
+ return {
+ ...stateProps,
+ ...otherDispatchProps,
+ ...ownProps,
+ gasPriceButtonGroupProps: {
+ ...gasPriceButtonGroupProps,
+ handleGasPriceSelection: dispatchSetGasPrice,
+ },
+ }
+} \ No newline at end of file