summaryrefslogtreecommitdiff
path: root/app/client/index.jsx
blob: 614bb35dfb0d81f280aba0206b63a454b41ea120 (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
import { h, render } from 'preact'
import { Provider } from 'react-redux'
import { BrowserRouter, Route } from 'react-router-dom'
// import client from './client'

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

import Auth from './auth'
import { Header, 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 app = (
  <Provider store={store}>
    <Auth.Gate>
      <BrowserRouter>
        <div>
          <Route exact path='/' component={Dashboard} />
          <Route path='/system/' component={System} />
          <Route path='/dashboard/' component={Dashboard} />
          <Route path='/logout/' component={Auth.Logout} />
          {module_list}
          <Route path='/' component={Header} />
          <AudioPlayer />
        </div>
      </BrowserRouter>
    </Auth.Gate>
  </Provider>
)

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