import React, { Component } from 'react'; import { connect } from 'react-redux'; import { translateRaw } from 'translations'; import { toWei } from 'libs/units'; import { AppState } from 'features/reducers'; import { scheduleActions, scheduleSelectors } from 'features/schedule'; import { transactionMetaSelectors } from 'features/transaction'; import { Input, Tooltip } from 'components/ui'; import Help from 'components/ui/Help'; interface OwnProps { decimal: number; scheduleDeposit: any; validScheduleDeposit: boolean; } interface DispatchProps { setScheduleDepositField: scheduleActions.TSetScheduleDepositField; } type Props = OwnProps & DispatchProps; class ScheduleDepositFieldClass extends Component { public render() { const { scheduleDeposit, validScheduleDeposit } = this.props; return (
); } private handleDepositChange = (ev: React.FormEvent) => { const { decimal } = this.props; const { value } = ev.currentTarget; this.props.setScheduleDepositField({ raw: value, value: value ? toWei(value, decimal) : null }); }; } export const ScheduleDepositField = connect( (state: AppState) => ({ decimal: transactionMetaSelectors.getDecimal(state), scheduleDeposit: scheduleSelectors.getScheduleDeposit(state), validScheduleDeposit: scheduleSelectors.isValidScheduleDeposit(state) }), { setScheduleDepositField: scheduleActions.setScheduleDepositField } )(ScheduleDepositFieldClass);