UNPKG

symphony-integration-commons

Version:

Common components for 3rd party developers build the user facing application for Symphony Integrations.

47 lines (40 loc) 1.1 kB
import React, { PropTypes, Component } from 'react'; import { connect } from 'react-redux'; import { hashHistory } from 'react-router'; import { submitDone, } from '../../actions'; import '../../styles/main.less'; import './styles/styles.less'; class SubmitConfirmation extends Component { componentWillReceiveProps(nextProps) { if (this.props.loading !== nextProps.loading) { if (nextProps.loading) { hashHistory.push('/'); } } } render() { return ( <div className='wrapper'> <div className='submit-container'> <button className='button' onClick={() => { this.props.callSubmitDone(); }}>Done</button> </div> </div> ); } } SubmitConfirmation.propTypes = { callSubmitDone: PropTypes.func.isRequired, loading: PropTypes.bool.isRequired, }; const mapStateToProps = state => ({ loading: state.instanceList.loading, }); const mapDispatchToProps = dispatch => ({ callSubmitDone: () => { dispatch(submitDone()); }, }); export default connect( mapStateToProps, mapDispatchToProps, )(SubmitConfirmation);