aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js
diff options
context:
space:
mode:
authorDan Miller <danjm.com@gmail.com>2018-09-13 16:47:05 +0800
committerDan Miller <danjm.com@gmail.com>2018-12-04 11:36:04 +0800
commit7de3f22d63748ed5a81e947755db056d4cdef3db (patch)
tree748482505ce65c3de4e71787d27b69d71156b522 /ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js
parent6ada9b4a3c02014f8d00b1f45a149afbf47f700d (diff)
downloadtangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.gz
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.bz2
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.lz
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.xz
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.zst
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.zip
Connects remained of the gas customization component to redux.
Diffstat (limited to 'ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js')
-rw-r--r--ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js80
1 files changed, 57 insertions, 23 deletions
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js b/ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js
index 399520baf..89065472d 100644
--- a/ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js
+++ b/ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js
@@ -17,34 +17,42 @@ export default class GasModalPageContainer extends Component {
customGasPrice: PropTypes.number,
customGasLimit: PropTypes.number,
gasPriceButtonGroupProps: PropTypes.object,
+ infoRowProps: PropTypes.shape({
+ originalTotalFiat: PropTypes.string,
+ originalTotalEth: PropTypes.string,
+ newTotalFiat: PropTypes.string,
+ newTotalEth: PropTypes.string,
+ }),
+ onSubmit: PropTypes.func,
+ customGasPriceInHex: PropTypes.string,
+ customGasLimitInHex: PropTypes.string,
}
state = {}
- renderBasicTabContent () {
+ renderBasicTabContent (gasPriceButtonGroupProps) {
return (
<BasicTabContent
- gasPriceButtonGroupProps={this.props.gasPriceButtonGroupProps}
+ gasPriceButtonGroupProps={gasPriceButtonGroupProps}
/>
)
}
- renderAdvancedTabContent = () => {
- const {
- updateCustomGasPrice,
- updateCustomGasLimit,
- customGasPrice,
- customGasLimit,
- } = this.props
-
+ renderAdvancedTabContent ({
+ convertThenUpdateCustomGasPrice,
+ convertThenUpdateCustomGasLimit,
+ customGasPrice,
+ customGasLimit,
+ newTotalFiat,
+ }) {
return (
<AdvancedTabContent
- updateCustomGasPrice={updateCustomGasPrice}
- updateCustomGasLimit={updateCustomGasLimit}
+ updateCustomGasPrice={convertThenUpdateCustomGasPrice}
+ updateCustomGasLimit={convertThenUpdateCustomGasLimit}
customGasPrice={customGasPrice}
customGasLimit={customGasLimit}
millisecondsRemaining={91000}
- totalFee={'$0.30'}
+ totalFee={newTotalFiat}
/>
)
}
@@ -64,41 +72,67 @@ export default class GasModalPageContainer extends Component {
)
}
- renderTabContent (mainTabContent) {
+ renderInfoRows (originalTotalFiat, originalTotalEth, newTotalFiat, newTotalEth) {
return (
- <div className="gas-modal-content">
- { mainTabContent }
- { this.renderInfoRow('gas-modal-content__info-row--fade', 'originalTotal', '$20.02 USD', '0.06685 ETH') }
- { this.renderInfoRow('gas-modal-content__info-row', 'newTotal', '$20.02 USD', '0.06685 ETH') }
+ <div>
+ { this.renderInfoRow('gas-modal-content__info-row--fade', 'originalTotal', originalTotalFiat, originalTotalEth) }
+ { this.renderInfoRow('gas-modal-content__info-row', 'newTotal', newTotalFiat, newTotalEth) }
</div>
)
}
- renderTabs () {
+ renderTabs ({
+ originalTotalFiat,
+ originalTotalEth,
+ newTotalFiat,
+ newTotalEth,
+ },
+ {
+ gasPriceButtonGroupProps,
+ ...advancedTabProps
+ }) {
return (
<Tabs>
<Tab name={this.context.t('basic')}>
- { this.renderTabContent(this.renderBasicTabContent()) }
+ <div className="gas-modal-content">
+ { this.renderBasicTabContent(gasPriceButtonGroupProps) }
+ { this.renderInfoRows(originalTotalFiat, originalTotalEth, newTotalFiat, newTotalEth) }
+ </div>
</Tab>
<Tab name={this.context.t('advanced')}>
- { this.renderTabContent(this.renderAdvancedTabContent()) }
+ <div className="gas-modal-content">
+ { this.renderAdvancedTabContent(advancedTabProps) }
+ { this.renderInfoRows(originalTotalFiat, originalTotalEth, newTotalFiat, newTotalEth) }
+ </div>
</Tab>
</Tabs>
)
}
render () {
- const { hideModal } = this.props
+ const {
+ hideModal,
+ infoRowProps,
+ onSubmit,
+ customGasPriceInHex,
+ customGasLimitInHex,
+ ...tabProps
+ } = this.props
return (
<div className="gas-modal-page-container">
<PageContainer
title={this.context.t('customGas')}
subtitle={this.context.t('customGasSubTitle')}
- tabsComponent={this.renderTabs()}
+ tabsComponent={this.renderTabs(infoRowProps, tabProps)}
disabled={false}
onCancel={() => hideModal()}
onClose={() => hideModal()}
+ onSubmit={() => {
+ onSubmit(customGasLimitInHex, customGasPriceInHex)
+ hideModal()
+ }}
+ submitText={this.context.t('save')}
/>
</div>
)