import React, { Component } from 'react' import PropTypes from 'prop-types' import { MIN_GAS_PRICE_DEC, MIN_GAS_LIMIT_DEC, } from '../../../send/send.constants' import TimeRemaining from './time-remaining' export default class AdvancedTabContent extends Component { static contextTypes = { t: PropTypes.func, } static propTypes = { updateCustomGasPrice: PropTypes.func, updateCustomGasLimit: PropTypes.func, customGasPrice: PropTypes.number, customGasLimit: PropTypes.number, millisecondsRemaining: PropTypes.number, totalFee: PropTypes.string, } gasInput (value, onChange, min, precision, showGWEI) { return (
onChange(Number(event.target.value))} /> {showGWEI ? GWEI : null}
) } infoButton (onClick) { return } renderDataSummary (totalFee, millisecondsRemaining) { return (
{ this.context.t('newTransactionFee') } ~{ this.context.t('transactionTime') }
{totalFee}
) } renderGasEditRow (labelKey, ...gasInputArgs) { return (
{ this.context.t(labelKey) } { this.infoButton(() => {}) }
{ this.gasInput(...gasInputArgs) }
) } renderGasEditRows (customGasPrice, updateCustomGasPrice, customGasLimit, updateCustomGasLimit) { return (
{ this.renderGasEditRow('gasPriceNoDenom', customGasPrice, updateCustomGasPrice, MIN_GAS_PRICE_DEC, 9, true) } { this.renderGasEditRow('gasLimit', customGasLimit, updateCustomGasLimit, MIN_GAS_LIMIT_DEC, 0) }
) } render () { const { updateCustomGasPrice, updateCustomGasLimit, millisecondsRemaining, customGasPrice, customGasLimit, totalFee, } = this.props return (
{ this.renderDataSummary(totalFee, millisecondsRemaining) }
{ this.context.t('feeChartTitle') }
{ this.renderGasEditRows( customGasPrice, updateCustomGasPrice, customGasLimit, updateCustomGasLimit ) }
) } }