import React, { Component } from 'react'; import { AmountFieldFactory } from 'components/AmountFieldFactory'; import { AddressFieldFactory } from 'components/AddressFieldFactory'; import { connect } from 'react-redux'; import { AppState } from 'reducers'; import { GenerateTransaction, SendButton, SigningStatus, TXMetaDataPanel } from 'components'; import { resetWallet, TResetWallet } from 'actions/wallet'; import translate from 'translations'; import { getUnit } from 'selectors/transaction'; import { getCurrentBalance } from 'selectors/wallet'; import Spinner from 'components/ui/Spinner'; import { Wei, TokenValue } from 'libs/units'; interface StateProps { unit: string; resetWallet: TResetWallet; currentBalance: Wei | TokenValue | null; } type Props = StateProps; class FieldsClass extends Component { public render() { const { currentBalance } = this.props; return (
( )} />
{currentBalance === null ? (
) : ( ( {!isValid && (
WARNING: Your ether or token balance is not high enough to complete this transaction! Please send more funds or switch to a different wallet
)} {isValid && ( )}
)} /> )}
{currentBalance === null ? (
) : ( )}
); } private changeWallet = () => { this.props.resetWallet(); }; } export const Fields = connect( (state: AppState) => ({ unit: getUnit(state), currentBalance: getCurrentBalance(state) }), { resetWallet } )(FieldsClass);