client/src/index.js
author ymh <ymh.work@gmail.com>
Thu, 08 Nov 2018 16:03:28 +0100
changeset 171 03334a31130a
parent 168 ea92f4fe783d
child 199 c78d579f4b55
permissions -rw-r--r--
Add translation with react-i18next
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
431977d7c9a6 add first react application skeleton
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import React from 'react';
431977d7c9a6 add first react application skeleton
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
import ReactDOM from 'react-dom';
12
48ddaa42b810 Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents: 3
diff changeset
     3
import { Provider } from 'react-redux';
105
0a1d6560acac Introduce authenticated routes.
Alexandre Segura <mex.zktk@gmail.com>
parents: 89
diff changeset
     4
import { Route, Switch } from 'react-router';
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
     5
import { ConnectedRouter } from 'connected-react-router';
12
48ddaa42b810 Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents: 3
diff changeset
     6
import createHistory from 'history/createBrowserHistory';
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
     7
import { PersistGate } from 'redux-persist/integration/react'
3
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
     8
1
431977d7c9a6 add first react application skeleton
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
import App from './App';
62
b2514a9bcd49 migrate to redux-offline + various optimisation
ymh <ymh.work@gmail.com>
parents: 54
diff changeset
    10
import SessionList from './components/SessionList';
12
48ddaa42b810 Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents: 3
diff changeset
    11
import Session from './components/Session';
48ddaa42b810 Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents: 3
diff changeset
    12
import Login from './components/Login';
134
be36eed5e6e0 add menu to change current group and create a new group
ymh <ymh.work@gmail.com>
parents: 105
diff changeset
    13
import CreateGroup from './components/CreateGroup';
162
1fd73fdaf4c6 Add ReadOnlySession component and message when session list is empty
salimr <riwad.salim@yahoo.fr>
parents: 155
diff changeset
    14
import ReadOnlySession from './components/ReadOnlySession';
89
06f609adfbf8 Add registration page.
Alexandre Segura <mex.zktk@gmail.com>
parents: 62
diff changeset
    15
import Register from './components/Register';
53
d8588379529e Add settings page.
Alexandre Segura <mex.zktk@gmail.com>
parents: 12
diff changeset
    16
import Settings from './components/Settings';
1
431977d7c9a6 add first react application skeleton
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
import './index.css';
3
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    18
import registerServiceWorker from './registerServiceWorker';
3b5d37d84cfe Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    19
import configureStore from './store/configureStore';
54
fad489be9c77 add some config values
ymh <ymh.work@gmail.com>
parents: 53
diff changeset
    20
import config from './config';
105
0a1d6560acac Introduce authenticated routes.
Alexandre Segura <mex.zktk@gmail.com>
parents: 89
diff changeset
    21
import AuthenticatedRoute from './misc/AuthenticatedRoute';
1
431977d7c9a6 add first react application skeleton
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
171
03334a31130a Add translation with react-i18next
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    23
import './i18n';
03334a31130a Add translation with react-i18next
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    24
54
fad489be9c77 add some config values
ymh <ymh.work@gmail.com>
parents: 53
diff changeset
    25
const history = createHistory({
fad489be9c77 add some config values
ymh <ymh.work@gmail.com>
parents: 53
diff changeset
    26
    basename: config.basename
fad489be9c77 add some config values
ymh <ymh.work@gmail.com>
parents: 53
diff changeset
    27
});
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    28
const { store, persistor } = configureStore(history);
1
431977d7c9a6 add first react application skeleton
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
431977d7c9a6 add first react application skeleton
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
ReactDOM.render(
12
48ddaa42b810 Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents: 3
diff changeset
    31
  <Provider store={store}>
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    32
    <PersistGate loading={null} persistor={persistor} >
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    33
      <ConnectedRouter history={history}>
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    34
        <Switch>
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    35
          <Route exact path="/sessions/:id" component={Session} />
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    36
          <Route exact path="/sessions" component={SessionList} />
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    37
          <Route exact path="/register" component={Register} />
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    38
          <Route exact path="/login" component={Login} />
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    39
          <Route exact path="/create-group" component={CreateGroup} />
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    40
          <Route exact path="/read-only/:id" component={ReadOnlySession} />
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    41
          <AuthenticatedRoute exact path="/settings" component={Settings} store={store} />
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    42
          <Route exact path="/" component={App} />
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    43
        </Switch>
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    44
      </ConnectedRouter>
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 162
diff changeset
    45
    </PersistGate>
12
48ddaa42b810 Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents: 3
diff changeset
    46
  </Provider>,
48ddaa42b810 Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents: 3
diff changeset
    47
  document.getElementById('root')
1
431977d7c9a6 add first react application skeleton
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
);
431977d7c9a6 add first react application skeleton
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
registerServiceWorker();