diff --git a/packages/component-wizard/README.md b/packages/component-wizard/README.md index 4dad06438dc664791f1fa8d9f6c2f9042d2e4b2f..eb859bbd33ef85a468f3edff2562d906de3377a0 100644 --- a/packages/component-wizard/README.md +++ b/packages/component-wizard/README.md @@ -15,7 +15,7 @@ Configuration file must be under config `journal` (make use of `withJournal`) an | backText | Text to show on Back button - Go back 1 step | false | 'Back' | `string` | | nextText | Text to show on Back button - Go forward 1 step | false | 'Next' | `string` | | cancelText | Text to show on Cancel button - Go to `/` | false | 'Back' | `string` | -| submissionRedirect | Path to redirect user after submitting the form | false | `/` | `string` | +| submissionRedirect | Path to redirect user after submitting the form. Passes as state `project` as project.id and `version` as version.id | false | `/` | `string` | | confirmationModal | If present, component will be rendered as a modal before submitting the form. Accepts `toggleConfirming` to close the modal and must have 2 buttons for submit and close modal (see below) | false | none | `React Component` | | formSectionKeys | Redux form data model. Keys to be saved on the form. | true | [] | `array` | | dispatchFunctions | Functions to be dispatched in case a component needs a dispatched function (f.i. `uploadFile`) | true | none | `array` | diff --git a/packages/component-wizard/src/components/WizardFormStep.js b/packages/component-wizard/src/components/WizardFormStep.js index 0c372e59226c832a10fb21e0e9051431d4d834cd..e7a608633d00bd88b6e68de484030e0454cfdff3 100644 --- a/packages/component-wizard/src/components/WizardFormStep.js +++ b/packages/component-wizard/src/components/WizardFormStep.js @@ -65,7 +65,7 @@ const submitManuscript = ( ), ) .then(() => { - history.push(redirectPath) + history.push(redirectPath, { project: project.id, version: version.id }) }) .catch(error => { if (error.validationErrors) { diff --git a/packages/components-faraday/src/components/UIComponents/ConfirmationPage.js b/packages/components-faraday/src/components/UIComponents/ConfirmationPage.js new file mode 100644 index 0000000000000000000000000000000000000000..9419a8bfb235dabfab7d537cb29cc7e699118143 --- /dev/null +++ b/packages/components-faraday/src/components/UIComponents/ConfirmationPage.js @@ -0,0 +1,51 @@ +import React from 'react' +import { compose } from 'recompose' +import { connect } from 'react-redux' +import { get, isEmpty } from 'lodash' +import { withJournal } from 'xpub-journal' +import { getFragmentAuthors } from 'pubsweet-components-faraday/src/redux/authors' + +const ConfirmationPage = ({ journal, authors = [], location: { state } }) => { + const email = get(authors.find(a => a.isCorresponding), 'email') + return ( + <div style={{ width: '70vw', margin: '0 auto' }}> + {isEmpty(state) ? ( + <h2>Thank you for you submission</h2> + ) : ( + <div> + <h2>Thank You for Submitting Your Manuscript</h2> + <p> + Your manuscript has been successfully submitted to{' '} + {journal.metadata.name}. + </p> + <p> + An acknowledgement email will be sent to{' '} + <a href={`mailto:${email}`}>{email}</a> when our system has finished + processing the submission. At that point, you will be able to track + the status of your submission. Please note, this may take a few + minutes. + </p> + <p> + Click{' '} + <a + href={`/projects/${state.project}/versions/${ + state.version + }/manuscript`} + > + {' '} + here{' '} + </a>{' '} + to return to your account in the Manuscript Tracking System. + </p> + </div> + )} + </div> + ) +} + +export default compose( + withJournal, + connect((state, { location: { state: locationState } }) => ({ + authors: getFragmentAuthors(state, get(locationState, 'version')), + })), +)(ConfirmationPage) diff --git a/packages/xpub-faraday/app/routes.js b/packages/xpub-faraday/app/routes.js index 0679a1da98fc652db1f106c288c3ef8a15466ea6..453c8be983a916802c53f5f4fb0f9173ec424354 100644 --- a/packages/xpub-faraday/app/routes.js +++ b/packages/xpub-faraday/app/routes.js @@ -12,8 +12,8 @@ import { import DashboardPage from 'pubsweet-component-xpub-dashboard/src/components/DashboardPage' import WizardPage from 'pubsweet-component-wizard/src/components/WizardPage' - -const ConfirmationPage = () => <h1>Confirmation page</h1> +import ManuscriptPage from 'pubsweet-component-xpub-manuscript/src/components/ManuscriptPage' +import ConfirmationPage from 'pubsweet-components-faraday/src/components/UIComponents/ConfirmationPage' const Routes = () => ( <App> @@ -31,6 +31,11 @@ const Routes = () => ( exact path="/projects/:project/versions/:version/submit" /> + <PrivateRoute + component={ManuscriptPage} + exact + path="/projects/:project/versions/:version/manuscript" + /> </App> )