import React from 'react'; import { NonceFieldFactory } from 'components/NonceFieldFactory'; import Help from 'components/ui/Help'; import RefreshIcon from 'assets/images/refresh.svg'; import './NonceField.scss'; import { InlineSpinner } from 'components/ui/InlineSpinner'; import { connect } from 'react-redux'; import { getNonceRequested, TGetNonceRequested } from 'actions/transaction'; import { nonceRequestPending } from 'selectors/transaction'; import { AppState } from 'reducers'; interface OwnProps { alwaysDisplay: boolean; } interface StateProps { nonePending: boolean; } interface DispatchProps { requestNonce: TGetNonceRequested; } type Props = OwnProps & DispatchProps & StateProps; class NonceField extends React.Component { public render() { const { alwaysDisplay, requestNonce, nonePending } = this.props; return ( { return alwaysDisplay || shouldDisplay ? (
) : null; }} /> ); } } const mapStateToProps = (state: AppState) => { return { nonePending: nonceRequestPending(state) }; }; export default connect(mapStateToProps, { requestNonce: getNonceRequested })(NonceField);