import { connect } from 'react-redux'; import React from 'react'; import { AppState } from 'reducers'; import { setScheduleGasPriceField, TSetScheduleGasPriceField } from 'actions/schedule'; import { translateRaw } from 'translations'; import { Input } from 'components/ui'; import { getScheduleGasPrice, isValidScheduleGasPrice } from 'selectors/schedule/fields'; import { gasPriceToBase } from 'libs/units'; interface OwnProps { scheduleGasPrice: any; validScheduleGasPrice: boolean; } interface DispatchProps { setScheduleGasPriceField: TSetScheduleGasPriceField; } type Props = OwnProps & DispatchProps; class ScheduleGasPriceFieldClass extends React.Component { public render() { const { scheduleGasPrice, validScheduleGasPrice } = this.props; return (
); } private handleGasPriceChange = (ev: React.FormEvent) => { const { value } = ev.currentTarget; this.props.setScheduleGasPriceField({ raw: value, value: value ? gasPriceToBase(parseInt(value, 10)) : null }); }; } export const ScheduleGasPriceField = connect( (state: AppState) => ({ scheduleGasPrice: getScheduleGasPrice(state), validScheduleGasPrice: isValidScheduleGasPrice(state) }), { setScheduleGasPriceField } )(ScheduleGasPriceFieldClass);