summaryrefslogtreecommitdiff
path: root/app/client/index.jsx
blob: cf2616dc992b123cdbc4b78d5d0b10e6ce7447b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { h, render } from 'preact'
import { Provider } from 'react-redux'
import { BrowserRouter, Switch, Route, Redirect } from 'react-router-dom'

import { store, history } from './store'
import * as socket from './socket'
import util from './util'

import Auth from './auth'
import { Header, Browser, AudioPlayer } from './common'
import System from './system/system.component'
import Dashboard from './dashboard/dashboard.component'
import modules from './modules'

const module_list = Object.keys(modules).map(name => {
  const module = modules[name]
  return (
    <Route path={'/' + module.name} component={module.router} />
  )
})

const ModuleRouter = () => {
  return (
    <Switch></Switch>
  )  
}

const app = (
  <Provider store={store}>
    <Auth.Gate>
      <BrowserRouter>
        <div>
          <Route exact path='/system' component={System} />
          <Route exact path='/dashboard' component={Dashboard} />
          <Route exact path='/browse' component={Browser} />
          <Route exact path='/logout' component={Auth.Logout} />
          {module_list}
          <Route exact path='/' component={Dashboard} />
          <Route path='/' component={Header} />
        </div>
      </BrowserRouter>
      <AudioPlayer />
    </Auth.Gate>
  </Provider>
)
/*
          <Route exact path='/login' component={() => { <Redirect to='/' /> }} />
          <Route exact path='/signup' component={() => { <Redirect to='/' /> }} />
*/

render(app, document.getElementById('container'))