import React from 'react'; import { connect } from 'react-redux'; import { Spin, Icon } from 'antd'; import { Link } from 'react-router-dom'; import { createActions } from 'modules/create'; import { AppState } from 'store/reducers'; import './Final.less'; interface StateProps { form: AppState['create']['form']; submittedProposal: AppState['create']['submittedProposal']; submitError: AppState['create']['submitError']; } interface DispatchProps { submitProposal: typeof createActions['submitProposal']; } type Props = StateProps & DispatchProps; class CreateFinal extends React.Component { componentDidMount() { this.submit(); } render() { const { submittedProposal, submitError } = this.props; let content; if (submitError) { content = (
Something went wrong during creation: "{submitError}"{' '} Click here to try again.
); } else if (submittedProposal) { content = (
Your proposal has been submitted! Check your{' '} profile's pending proposals tab {' '}to check its status.
{/* TODO - remove or rework depending on design choices */} {/*
Your proposal has been submitted!{' '} Click here {' '}to check it out.
*/}
); } else { content = (
Submitting your proposal...
); } return
{content}
; } private submit = () => { if (this.props.form) { this.props.submitProposal(this.props.form); } }; } export default connect( (state: AppState) => ({ form: state.create.form, submittedProposal: state.create.submittedProposal, submitError: state.create.submitError, }), { submitProposal: createActions.submitProposal, }, )(CreateFinal);