receptor/src/index.js

39 lines
938 B
JavaScript
Raw Normal View History

2017-08-24 15:50:14 +02:00
import "babel-polyfill";
2017-08-07 00:23:54 +02:00
import React from 'react';
import ReactDOM from 'react-dom';
2017-08-20 17:57:57 +02:00
import { Provider } from 'react-redux';
2017-08-24 14:30:22 +02:00
import { ConnectedRouter } from 'react-router-redux';
import 'preact/devtools';
2017-08-20 17:57:57 +02:00
2017-08-24 14:30:22 +02:00
import store, { history } from './store';
2017-08-22 21:49:48 +02:00
import scss from '../scss/main.scss';
import { ws_init } from './socket';
import { filter_subscribe } from './actions/filter_subscribe';
2017-08-22 21:49:48 +02:00
import Nav from './ui/navigation';
import Main from './ui/main';
ws_init(() => {
store.dispatch(filter_subscribe());
store.dispatch(filter_subscribe('server'));
});
2017-08-07 00:23:54 +02:00
const render = App => ReactDOM.render(
2017-08-20 17:57:57 +02:00
<Provider store={store}>
2017-08-24 14:30:22 +02:00
<ConnectedRouter history={history}>
<div>
<Nav />
<div className="container">
<App />
2017-08-24 14:30:22 +02:00
</div>
2017-08-22 21:49:48 +02:00
</div>
2017-08-24 14:30:22 +02:00
</ConnectedRouter>
2017-08-20 17:57:57 +02:00
</Provider>,
document.getElementById('root'));
render(Main);
if (module.hot) {
module.hot.accept('./ui/main', () => render(Main));
}