Commit ce6e9d19 authored by Jure's avatar Jure

Use Actions from pubsweet-ui

parent 9a1f84f8
......@@ -2,9 +2,9 @@ import React from 'react'
import PropTypes from 'prop-types'
import AuthenticatedComponent from 'pubsweet-client/src/components/AuthenticatedComponent'
import Navigation from '../Navigation/Navigation'
import Navigation from './Navigation/Navigation'
const AuthenticatedManage = ({ children, ...props }) => (
const App = ({ children, ...props }) => (
<div>
<Navigation />
<AuthenticatedComponent
......@@ -18,8 +18,8 @@ const AuthenticatedManage = ({ children, ...props }) => (
</div>
)
AuthenticatedManage.propTypes = {
App.propTypes = {
children: PropTypes.node.isRequired,
}
export default AuthenticatedManage
export default App
import React from 'react'
import PropTypes from 'prop-types'
import { NavLink } from 'react-router-dom'
import { connect } from 'react-redux'
import Authorize from 'pubsweet-client/src/helpers/Authorize'
import actions from 'pubsweet-client/src/actions'
import { AppBar } from '@pubsweet/ui'
import { Action, AppBar } from '@pubsweet/ui'
const Navigation = ({ logoutUser, currentUser }) => (
<AppBar
brand={<img alt="pubsweet" src="/assets/pubsweet.jpg" />}
navLinkComponents={[
<NavLink to="/manage/posts">Posts</NavLink>,
<Action to="/manage/posts">Posts</Action>,
<Authorize object={{ path: '/users' }} operation="GET">
<NavLink to="/manage/users">Users</NavLink>
<Action to="/manage/users">Users</Action>
</Authorize>,
<Authorize object={{ path: '/teams' }} operation="GET">
<NavLink to="/manage/teams">Teams</NavLink>
<Action to="/manage/teams">Teams</Action>
</Authorize>,
]}
onLogoutClick={logoutUser}
......
......@@ -3,6 +3,7 @@ import { Route, Switch } from 'react-router-dom'
// Manage
import PostsManager from 'pubsweet-component-posts-manager/PostsManagerContainer'
import UsersManager from 'pubsweet-component-users-manager/src/UsersManagerContainer'
// Public
import Blog from 'pubsweet-component-blog/BlogContainer'
......@@ -13,23 +14,19 @@ import Login from 'pubsweet-component-login/LoginContainer'
import Signup from 'pubsweet-component-signup/SignupContainer'
import PasswordReset from 'pubsweet-component-password-reset-frontend/PasswordReset'
import AuthenticatedManage from './components/AuthenticatedManage/AuthenticatedManage'
import App from './components/App'
const Managed = () => (
<AuthenticatedManage>
export default (
<App>
<Switch>
<Route component={Blog} exact path="/" />
<Route component={UsersManager} path="/manage/users" />
<Route component={PostsManager} path="/manage/posts" />
</Switch>
</AuthenticatedManage>
)
export default (
<Switch>
<Route component={Blog} exact path="/" />
<Route component={Managed} path="/manage" />
<Route component={Login} path="/login" />
<Route component={Signup} path="/signup" />
<Route component={PasswordReset} path="/password-reset" />
<Route component={HTML} path="/:id" />
</Switch>
<Route component={Login} path="/login" />
<Route component={Signup} path="/signup" />
<Route component={PasswordReset} path="/password-reset" />
<Route component={HTML} path="/:id" />
</Switch>
</App>
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment