From 7961f5c114a4e3f62eb61ed8205f246d8bc533f3 Mon Sep 17 00:00:00 2001
From: Bogdan Cochior <bogdan.cochior@thinslices.com>
Date: Wed, 24 Jan 2018 16:03:17 +0200
Subject: [PATCH] Fix routing

---
 .../UIComponents/ConfirmationPage.js          | 48 ++++++++++++-------
 .../src/components/UIComponents/NotFound.js   |  5 +-
 .../UIComponents/UIComponents.local.scss      |  9 ++++
 .../app/config/journal/metadata.js            |  1 +
 packages/xpub-faraday/app/routes.js           | 44 +++++++++--------
 5 files changed, 67 insertions(+), 40 deletions(-)
 create mode 100644 packages/components-faraday/src/components/UIComponents/UIComponents.local.scss

diff --git a/packages/components-faraday/src/components/UIComponents/ConfirmationPage.js b/packages/components-faraday/src/components/UIComponents/ConfirmationPage.js
index 9419a8bfb..35cd47980 100644
--- a/packages/components-faraday/src/components/UIComponents/ConfirmationPage.js
+++ b/packages/components-faraday/src/components/UIComponents/ConfirmationPage.js
@@ -1,14 +1,23 @@
 import React from 'react'
+import classnames from 'classnames'
 import { compose } from 'recompose'
 import { connect } from 'react-redux'
+import { Button } from '@pubsweet/ui'
 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 } }) => {
+import classes from './UIComponents.local.scss'
+
+const ConfirmationPage = ({
+  journal,
+  authors = [],
+  location: { state },
+  history,
+}) => {
   const email = get(authors.find(a => a.isCorresponding), 'email')
   return (
-    <div style={{ width: '70vw', margin: '0 auto' }}>
+    <div className={classnames(classes.container)}>
       {isEmpty(state) ? (
         <h2>Thank you for you submission</h2>
       ) : (
@@ -16,27 +25,30 @@ const ConfirmationPage = ({ journal, authors = [], location: { state } }) => {
           <h2>Thank You for Submitting Your Manuscript</h2>
           <p>
             Your manuscript has been successfully submitted to{' '}
-            {journal.metadata.name}.
+            <b>{journal.metadata.nameText}</b> and assigned the manuscript ID{' '}
+            <b>
+              {' '}
+              <a
+                href={`/projects/${state.project}/versions/${
+                  state.version
+                }/manuscript`}
+              >
+                {state.project}
+              </a>
+            </b>.
           </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.
+            An acknowledgement email will be sent to {email} 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.
+            {`You can keep track of your submission's progress on your dashboard.`}
           </p>
+          <Button onClick={() => history.push('/')} primary>
+            Go to Dashboard
+          </Button>
         </div>
       )}
     </div>
diff --git a/packages/components-faraday/src/components/UIComponents/NotFound.js b/packages/components-faraday/src/components/UIComponents/NotFound.js
index e72b54b8b..f0c04c2e2 100644
--- a/packages/components-faraday/src/components/UIComponents/NotFound.js
+++ b/packages/components-faraday/src/components/UIComponents/NotFound.js
@@ -1,8 +1,11 @@
 import React from 'react'
 import { Icon } from '@pubsweet/ui'
+import classnames from 'classnames'
+
+import classes from './UIComponents.local.scss'
 
 const NotFound = ({ history }) => (
-  <div style={{ width: '70vw', margin: '0 auto', textAlign: 'center' }}>
+  <div className={classnames(classes.container)}>
     <div>
       <Icon size={32}>cloud-off</Icon>
     </div>
diff --git a/packages/components-faraday/src/components/UIComponents/UIComponents.local.scss b/packages/components-faraday/src/components/UIComponents/UIComponents.local.scss
new file mode 100644
index 000000000..10255c4b4
--- /dev/null
+++ b/packages/components-faraday/src/components/UIComponents/UIComponents.local.scss
@@ -0,0 +1,9 @@
+.container {
+  margin: 0 auto;
+  text-align: center;
+  width: 70vw;
+
+  a {
+    color: black;
+  }
+}
diff --git a/packages/xpub-faraday/app/config/journal/metadata.js b/packages/xpub-faraday/app/config/journal/metadata.js
index 06375b6dc..f099501bf 100644
--- a/packages/xpub-faraday/app/config/journal/metadata.js
+++ b/packages/xpub-faraday/app/config/journal/metadata.js
@@ -5,4 +5,5 @@ export default {
   issn: '2474-7394',
   name: <Logo srcUrl="/assets/hindawi-logo.png" />,
   logo: '/assets/hindawi-logo.png',
+  nameText: 'Faraday Journal',
 }
diff --git a/packages/xpub-faraday/app/routes.js b/packages/xpub-faraday/app/routes.js
index 93cd5915e..36a635a46 100644
--- a/packages/xpub-faraday/app/routes.js
+++ b/packages/xpub-faraday/app/routes.js
@@ -1,5 +1,5 @@
 import React from 'react'
-import { Route } from 'react-router-dom'
+import { Route, Switch } from 'react-router-dom'
 
 import App from 'pubsweet-component-xpub-app/src/components'
 
@@ -18,26 +18,28 @@ import NotFound from 'pubsweet-components-faraday/src/components/UIComponents/No
 
 const Routes = () => (
   <App>
-    <Route component={LoginPage} exact path="/login" />
-    <Route component={SignupPage} exact path="/signup" />
-    <PrivateRoute component={DashboardPage} exact path="/" />
-    <PrivateRoute
-      component={ConfirmationPage}
-      exact
-      path="/confirmation-page"
-    />
-    <PrivateRoute component={LogoutPage} exact path="/logout" />
-    <PrivateRoute
-      component={WizardPage}
-      exact
-      path="/projects/:project/versions/:version/submit"
-    />
-    <PrivateRoute
-      component={ManuscriptPage}
-      exact
-      path="/projects/:project/versions/:version/manuscript"
-    />
-    <Route component={NotFound} path="*" />
+    <Switch>
+      <Route component={LoginPage} exact path="/login" />
+      <Route component={SignupPage} exact path="/signup" />
+      <PrivateRoute component={DashboardPage} exact path="/" />
+      <PrivateRoute
+        component={ConfirmationPage}
+        exact
+        path="/confirmation-page"
+      />
+      <PrivateRoute component={LogoutPage} exact path="/logout" />
+      <PrivateRoute
+        component={WizardPage}
+        exact
+        path="/projects/:project/versions/:version/submit"
+      />
+      <PrivateRoute
+        component={ManuscriptPage}
+        exact
+        path="/projects/:project/versions/:version/manuscript"
+      />
+      <Route component={NotFound} />
+    </Switch>
   </App>
 )
 
-- 
GitLab