import React from 'react'; import { connect } from 'react-redux'; import translate from 'translations'; import { AppState } from 'features/reducers'; import { getOffline } from 'features/config'; import { transactionNetworkActions, transactionNetworkSelectors } from 'features/transaction'; import { Spinner, Input } from 'components/ui'; import Help from 'components/ui/Help'; import { NonceFieldFactory } from 'components/NonceFieldFactory'; import './NonceField.scss'; interface OwnProps { alwaysDisplay: boolean; } interface StateProps { isOffline: boolean; noncePending: boolean; } interface DispatchProps { requestNonce: transactionNetworkActions.TGetNonceRequested; } type Props = OwnProps & DispatchProps & StateProps; class NonceField extends React.Component { public render() { const { alwaysDisplay, requestNonce, noncePending, isOffline } = this.props; return ( { return alwaysDisplay || shouldDisplay ? (
) : null; }} /> ); } } const mapStateToProps = (state: AppState): StateProps => { return { isOffline: getOffline(state), noncePending: transactionNetworkSelectors.nonceRequestPending(state) }; }; export default connect(mapStateToProps, { requestNonce: transactionNetworkActions.getNonceRequested })(NonceField);