diff --git a/packages/component-manuscript/package.json b/packages/component-manuscript/package.json new file mode 100644 index 0000000000000000000000000000000000000000..110b73775085837e6e623990f86fde486d961003 --- /dev/null +++ b/packages/component-manuscript/package.json @@ -0,0 +1,6 @@ +{ + "name": "pubsweet-component-manuscript", + "version": "0.0.1", + "main": "src", + "license": "MIT" +} diff --git a/packages/component-manuscript/src/components/Details.js b/packages/component-manuscript/src/components/Details.js new file mode 100644 index 0000000000000000000000000000000000000000..2249fc2a1382e791a0f37f528b424b0621d5b77e --- /dev/null +++ b/packages/component-manuscript/src/components/Details.js @@ -0,0 +1,27 @@ +import React from 'react' +import { connect } from 'react-redux' +import { replace } from 'react-router-redux' +import { compose, lifecycle } from 'recompose' +import { selectCurrentUser } from 'xpub-selectors' + +import { parseSearchParams } from './utils' + +const Details = () => <div>eu sunt manuscript details</div> + +export default compose( + connect( + state => ({ + currentUser: selectCurrentUser(state), + }), + { replace }, + ), + lifecycle({ + componentDidMount() { + const { location, replace } = this.props + const { accept } = parseSearchParams(location.search) + if (accept === 'true') { + replace(location.pathname) + } + }, + }), +)(Details) diff --git a/packages/component-manuscript/src/components/index.js b/packages/component-manuscript/src/components/index.js new file mode 100644 index 0000000000000000000000000000000000000000..08c9ae9088c3f3a1256b067abdab21339cf04098 --- /dev/null +++ b/packages/component-manuscript/src/components/index.js @@ -0,0 +1 @@ +export { default as ManuscriptDetails } from './Details' diff --git a/packages/component-manuscript/src/components/utils.js b/packages/component-manuscript/src/components/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..4f264402c54df9f81ce41908b74ce063b72d3e73 --- /dev/null +++ b/packages/component-manuscript/src/components/utils.js @@ -0,0 +1,10 @@ +/* eslint-disable */ + +export const parseSearchParams = url => { + const params = new URLSearchParams(url) + const parsedObject = {} + for ([key, value] of params) { + parsedObject[key] = value + } + return parsedObject +} diff --git a/packages/component-manuscript/src/index.js b/packages/component-manuscript/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8d52f148e8c8927db1d86494ca404451da5a917d --- /dev/null +++ b/packages/component-manuscript/src/index.js @@ -0,0 +1,5 @@ +module.exports = { + client: { + components: [() => require('./components')], + }, +} diff --git a/packages/xpub-faraday/app/routes.js b/packages/xpub-faraday/app/routes.js index c17addb48667b42cf6bd1273c13a8cdeef285a2c..c65e01a8ebbca217f5f75c59d8dbb15228b4d8dd 100644 --- a/packages/xpub-faraday/app/routes.js +++ b/packages/xpub-faraday/app/routes.js @@ -5,10 +5,11 @@ import { AuthenticatedComponent } from 'pubsweet-client' import Login from 'pubsweet-component-login/LoginContainer' import Signup from 'pubsweet-component-signup/SignupContainer' -import DashboardPage from 'pubsweet-components-faraday/src/components/Dashboard' import { Wizard } from 'pubsweet-component-wizard/src/components' -import ConfirmationPage from 'pubsweet-components-faraday/src/components/UIComponents/ConfirmationPage' +import { ManuscriptDetails } from 'pubsweet-component-manuscript/src/components' +import DashboardPage from 'pubsweet-components-faraday/src/components/Dashboard' import NotFound from 'pubsweet-components-faraday/src/components/UIComponents/NotFound' +import ConfirmationPage from 'pubsweet-components-faraday/src/components/UIComponents/ConfirmationPage' import { AdminDashboard, AdminUsers, @@ -61,6 +62,7 @@ const Routes = () => ( /> <Route component={SignUpInvitationPage} exact path="/invite" /> <Route component={ReviewerSignUp} exact path="/invite-reviewer" /> + <PrivateRoute component={ManuscriptDetails} exact path="/manu-details" /> <Route component={NotFound} /> </Switch> </FaradayApp> diff --git a/packages/xpub-faraday/config/components.json b/packages/xpub-faraday/config/components.json index 7b325481ccfefa823809c0e259b84dd436c2f965..5d3e7cc1f02bb95300d2844f2b9f0f0fb3fa5459 100644 --- a/packages/xpub-faraday/config/components.json +++ b/packages/xpub-faraday/config/components.json @@ -8,5 +8,6 @@ "@pubsweet/component-aws-s3", "pubsweet-component-invite", "pubsweet-component-user-manager", - "pubsweet-component-email" + "pubsweet-component-email", + "pubsweet-component-manuscript" ]