diff --git a/packages/components-faraday/src/components/Admin/Admin.js b/packages/components-faraday/src/components/Admin/Admin.js new file mode 100644 index 0000000000000000000000000000000000000000..8bb2efb4763a63d6895a9e2eb109a9b8c88655b7 --- /dev/null +++ b/packages/components-faraday/src/components/Admin/Admin.js @@ -0,0 +1,21 @@ +import React from 'react' +import PropTypes from 'prop-types' + +import classes from './Admin.local.scss' + +const Admin = ({ users }) => ( + <div className={classes.root}> + <h2>Admin</h2> + <ul> + {users.map((u, i) => ( + <li key={i}> + {u.username} - {u.email} + </li> + ))} + </ul> + </div> +) + +Admin.propTypes = {} + +export default Admin diff --git a/packages/components-faraday/src/components/Admin/Admin.local.scss b/packages/components-faraday/src/components/Admin/Admin.local.scss new file mode 100644 index 0000000000000000000000000000000000000000..6ea81ade44fa58f18373e06c91eed42c61da4037 --- /dev/null +++ b/packages/components-faraday/src/components/Admin/Admin.local.scss @@ -0,0 +1,6 @@ +.root { + display: flex; + flex-direction: column; + margin: auto; + max-width: 60em; +} diff --git a/packages/components-faraday/src/components/Admin/AdminPage.js b/packages/components-faraday/src/components/Admin/AdminPage.js new file mode 100644 index 0000000000000000000000000000000000000000..40a751d36ae83c6d0e7dde55ce75ef8c08ce2539 --- /dev/null +++ b/packages/components-faraday/src/components/Admin/AdminPage.js @@ -0,0 +1,15 @@ +import { get } from 'lodash' +import PropTypes from 'prop-types' +import { compose } from 'recompose' +import { connect } from 'react-redux' +import { actions } from 'pubsweet-client' +import { ConnectPage } from 'xpub-connect' +import { withRouter } from 'react-router-dom' + +import Admin from './Admin' + +export default compose( + ConnectPage(() => [actions.getUsers()]), + withRouter, + connect(state => ({ users: get(state, 'users.users') })), +)(Admin) diff --git a/packages/components-faraday/src/components/Admin/index.js b/packages/components-faraday/src/components/Admin/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f623059ef006ec5d6c516c651bdaa474feb4f073 --- /dev/null +++ b/packages/components-faraday/src/components/Admin/index.js @@ -0,0 +1,3 @@ +import AdminPage from './AdminPage' + +export default AdminPage diff --git a/packages/xpub-faraday/app/routes.js b/packages/xpub-faraday/app/routes.js index 2f6b1b7839ce71fbc32ee6d4478851ae77653898..b2bba7ac7b8b2abb7d3a8bffa46b213c7e88388f 100644 --- a/packages/xpub-faraday/app/routes.js +++ b/packages/xpub-faraday/app/routes.js @@ -16,6 +16,7 @@ import { Wizard } from 'pubsweet-component-wizard/src/components' import ManuscriptPage from 'pubsweet-component-xpub-manuscript/src/components/ManuscriptPage' import ConfirmationPage from 'pubsweet-components-faraday/src/components/UIComponents/ConfirmationPage' import NotFound from 'pubsweet-components-faraday/src/components/UIComponents/NotFound' +import AdminPage from 'pubsweet-components-faraday/src/components/Admin' const Routes = () => ( <App> @@ -28,6 +29,7 @@ const Routes = () => ( exact path="/confirmation-page" /> + <PrivateRoute component={AdminPage} exact path="/admin" /> <PrivateRoute component={LogoutPage} exact path="/logout" /> <PrivateRoute component={Wizard}