2017-10-13 22:19:22 +02:00
|
|
|
const Component = require('react').Component
|
2018-03-29 17:00:44 +02:00
|
|
|
const PropTypes = require('prop-types')
|
2017-10-13 22:19:22 +02:00
|
|
|
const h = require('react-hyperscript')
|
|
|
|
const inherits = require('util').inherits
|
2017-10-17 19:22:23 +02:00
|
|
|
const CurrencyDisplay = require('./currency-display')
|
2018-03-29 17:00:44 +02:00
|
|
|
const connect = require('react-redux').connect
|
|
|
|
|
|
|
|
GasFeeDisplay.contextTypes = {
|
|
|
|
t: PropTypes.func,
|
|
|
|
}
|
2017-10-13 22:19:22 +02:00
|
|
|
|
2018-03-22 01:41:47 +01:00
|
|
|
module.exports = connect()(GasFeeDisplay)
|
2017-10-13 22:19:22 +02:00
|
|
|
|
2018-03-29 17:00:44 +02:00
|
|
|
|
2017-10-13 22:19:22 +02:00
|
|
|
inherits(GasFeeDisplay, Component)
|
|
|
|
function GasFeeDisplay () {
|
|
|
|
Component.call(this)
|
|
|
|
}
|
|
|
|
|
|
|
|
GasFeeDisplay.prototype.render = function () {
|
|
|
|
const {
|
|
|
|
conversionRate,
|
2017-10-17 19:22:23 +02:00
|
|
|
gasTotal,
|
2017-10-13 22:19:22 +02:00
|
|
|
onClick,
|
2017-10-19 04:09:26 +02:00
|
|
|
primaryCurrency = 'ETH',
|
|
|
|
convertedCurrency,
|
2018-03-20 10:17:45 +01:00
|
|
|
gasLoadingError,
|
2017-10-13 22:19:22 +02:00
|
|
|
} = this.props
|
|
|
|
|
2017-10-19 19:53:56 +02:00
|
|
|
return h('div.send-v2__gas-fee-display', [
|
2017-10-13 22:19:22 +02:00
|
|
|
|
2017-10-17 19:22:23 +02:00
|
|
|
gasTotal
|
2017-10-13 22:19:22 +02:00
|
|
|
? h(CurrencyDisplay, {
|
2017-11-02 03:30:33 +01:00
|
|
|
primaryCurrency,
|
2017-10-19 04:09:26 +02:00
|
|
|
convertedCurrency,
|
2017-10-17 19:22:23 +02:00
|
|
|
value: gasTotal,
|
2017-10-13 22:19:22 +02:00
|
|
|
conversionRate,
|
|
|
|
convertedPrefix: '$',
|
|
|
|
readOnly: true,
|
|
|
|
})
|
2018-03-20 10:17:45 +01:00
|
|
|
: gasLoadingError
|
2018-03-29 17:00:44 +02:00
|
|
|
? h('div.currency-display.currency-display--message', this.context.t('setGasPrice'))
|
|
|
|
: h('div.currency-display', this.context.t('loading')),
|
2017-10-13 22:19:22 +02:00
|
|
|
|
2018-03-09 06:33:36 +01:00
|
|
|
h('button.sliders-icon-container', {
|
2017-10-13 22:19:22 +02:00
|
|
|
onClick,
|
2018-03-20 10:17:45 +01:00
|
|
|
disabled: !gasTotal && !gasLoadingError,
|
2017-10-13 22:19:22 +02:00
|
|
|
}, [
|
2018-03-09 06:33:36 +01:00
|
|
|
h('i.fa.fa-sliders.sliders-icon'),
|
2017-11-02 13:15:59 +01:00
|
|
|
]),
|
2017-10-13 22:19:22 +02:00
|
|
|
|
|
|
|
])
|
|
|
|
}
|