routes.jsx 4.42 KB
Newer Older
Alexandros Georgantas's avatar
Alexandros Georgantas committed
1 2 3 4 5
import React from 'react'
import { Redirect, Route, Switch } from 'react-router-dom'

// Users and Teams
import UsersManager from 'pubsweet-component-users-manager/UsersManagerContainer'
Alexandros Georgantas's avatar
Alexandros Georgantas committed
6
import GlobalTeamsManager from 'pubsweet-component-booksprints-globalteams/src/GlobalTeamsManager'
Alexandros Georgantas's avatar
Alexandros Georgantas committed
7 8 9 10 11 12 13 14 15 16 17 18
// import TeamsManager from 'pubsweet-component-teams-manager/TeamsManagerContainer'

// Authentication
import Login from 'pubsweet-component-login/LoginContainer'
import Signup from 'pubsweet-component-signup/SignupContainer'
import PasswordReset from 'pubsweet-component-password-reset-frontend/PasswordReset'

// Editor
import Wax from 'pubsweet-component-wax/src/WaxPubsweet'
import WithConfig from 'pubsweet-component-wax/src/WithConfig'

// Editoria
Alexandros Georgantas's avatar
ready  
Alexandros Georgantas committed
19 20
import BookBuilder from 'pubsweet-component-bookbuilder-booksprints/src/BookBuilder'
import Dashboard from 'pubsweet-component-editoria-dashboard-booksprints/src/Dashboard'
Alexandros Georgantas's avatar
Alexandros Georgantas committed
21
import Manage from 'pubsweet-component-manage/Manage'
Alexandros Georgantas's avatar
Alexandros Georgantas committed
22
import PagedStyler from 'pubsweet-component-bookbuilder-booksprints/src/PagedStyler/PagedStyler'
Alexandros Georgantas's avatar
Alexandros Georgantas committed
23 24 25 26 27 28 29 30
import Navigation from './components/Navigation/Navigation'
import PrivateRoute from './components/PrivateRoute'
// import AuthenticatedManage from './components/AuthenticatedManage/AuthenticatedManage'

// Pass configuration to editor
const Editor = WithConfig(Wax, {
  layout: 'editoria',
  lockWhenEditing: true,
31
  pollingTimer: 1500,
32
  autoSave: true,
Alexandros Georgantas's avatar
Alexandros Georgantas committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
  tools: [
    'document',
    'strong',
    'annotations',
    'note',
    'inline-note',
    'code',
    'insert-script',
    'ornament',
    'diacritics-tool',
    'find-and-replace-tool',
    'spell-check',
    'highlighter',
    'full-screen-control',
    'shortcuts-modal',
  ],
Alexandros Georgantas's avatar
Alexandros Georgantas committed
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
})

// export default (
//   <Manage nav={<Navigation />}>
//     <Switch>
//       <Redirect exact path='/' to='/books' />

//       <PrivateRoute exact path='/books' component={Dashboard} />
//       <PrivateRoute path='/books/:id/book-builder' component={BookBuilder} />
//       <PrivateRoute path='/books/:bookId/fragments/:fragmentId' component={Editor} />

//       <PrivateRoute path='/teams' component={TeamsManager} />
//       <PrivateRoute path='/users' component={UsersManager} />

//       <Route path='/login' component={Login} />
//       <Route path='/signup' component={Signup} />
//       <Route path='/password-reset' component={PasswordReset} />
//     </Switch>
//   </Manage>
// )

// export default (
//   <Switch>
//     <Redirect exact path="/" to="/books" />
//     <Route path="/login" component={Login} />
//     <Route path="/signup" component={Signup} />
//     <Route path="/password-reset" component={PasswordReset} />

//     <div>
//       <Navigation />

//       <PrivateRoute exact path="/books" component={Dashboard} />
//       <PrivateRoute path="/books/:id/book-builder" component={BookBuilder} />
//       <PrivateRoute
//         path="/books/:bookId/fragments/:fragmentId"
//         component={Editor}
//       />

//       <PrivateRoute path="/teams" component={TeamsManager} />
//       <PrivateRoute path="/users" component={UsersManager} />
//     </div>
//   </Switch>
// )

export default (
  <Switch>
    <Redirect exact path="/" to="/books" />
    <Route component={Login} path="/login" />
    <Route component={Signup} path="/signup" />
    <Route component={PasswordReset} path="/password-reset" />

    <Manage nav={<Navigation />}>
      <PrivateRoute component={Dashboard} exact path="/books" />
Alexandros Georgantas's avatar
Alexandros Georgantas committed
102 103 104 105
      <PrivateRoute
        component={PagedStyler}
        path="/books/:id/pagedPreviewer/paged/:hashed"
      />
Alexandros Georgantas's avatar
Alexandros Georgantas committed
106 107 108 109 110 111 112
      <PrivateRoute component={BookBuilder} path="/books/:id/book-builder" />

      <PrivateRoute
        component={Editor}
        path="/books/:bookId/fragments/:fragmentId"
      />
      <PrivateRoute component={UsersManager} path="/users" />
Alexandros Georgantas's avatar
Alexandros Georgantas committed
113
      <PrivateRoute component={GlobalTeamsManager} path="/globalTeams" />
Alexandros Georgantas's avatar
Alexandros Georgantas committed
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
    </Manage>
  </Switch>
)

// const Managed = () => (
//   <AuthenticatedManage>
//     <Switch>
//       <Route component={Dashboard} path="/manage/books" />
//       <Route component={UsersManager} path="/manage/users" />
//       <Route component={TeamsManager} path="/manage/teams" />
//       <Route component={BookBuilder} path="/manage/books/:id/book-builder" />
//     </Switch>
//   </AuthenticatedManage>
// )

// export default (
//   <Switch>
//     <Route component={Managed} path="/manage" />
//     <Route component={Login} path="/login" />
//     <Route component={Signup} path="/signup" />

//   </Switch>
// )