2018-11-29 11:54:05 +01:00
|
|
|
import './hot';
|
2015-12-29 00:34:32 +01:00
|
|
|
import React from 'react';
|
2018-11-29 11:54:05 +01:00
|
|
|
import { render } from 'react-dom';
|
2017-02-16 03:55:50 +01:00
|
|
|
|
2017-06-21 08:40:28 +02:00
|
|
|
import Root from 'components/Root';
|
2018-11-06 11:13:32 +01:00
|
|
|
import { appSet } from 'state/app';
|
2018-04-05 21:13:32 +02:00
|
|
|
import initRouter from 'utils/router';
|
|
|
|
import Socket from 'utils/Socket';
|
2015-12-29 00:34:32 +01:00
|
|
|
import configureStore from './store';
|
2017-05-07 22:19:15 +02:00
|
|
|
import routes from './routes';
|
2017-05-19 07:29:44 +02:00
|
|
|
import runModules from './modules';
|
2018-11-06 11:13:32 +01:00
|
|
|
import { register } from './serviceWorker';
|
2018-04-13 20:47:39 +02:00
|
|
|
import '../css/fonts.css';
|
|
|
|
import '../css/style.css';
|
2015-12-29 00:34:32 +01:00
|
|
|
|
2018-04-05 21:13:32 +02:00
|
|
|
const production = process.env.NODE_ENV === 'production';
|
2018-04-06 01:46:22 +02:00
|
|
|
const host = production
|
|
|
|
? window.location.host
|
|
|
|
: `${window.location.hostname}:1337`;
|
2016-01-15 02:27:30 +01:00
|
|
|
const socket = new Socket(host);
|
2017-05-07 22:19:15 +02:00
|
|
|
const store = configureStore(socket);
|
2016-01-26 22:10:44 +01:00
|
|
|
|
2017-05-19 07:29:44 +02:00
|
|
|
initRouter(routes, store);
|
|
|
|
runModules({ store, socket });
|
2017-04-20 01:51:55 +02:00
|
|
|
|
2018-11-29 11:54:05 +01:00
|
|
|
render(<Root store={store} />, document.getElementById('root'));
|
2018-11-06 11:13:32 +01:00
|
|
|
|
2018-11-10 12:18:45 +01:00
|
|
|
window.addEventListener('beforeinstallprompt', e => {
|
|
|
|
e.preventDefault();
|
|
|
|
store.dispatch(appSet('installable', e));
|
|
|
|
});
|
|
|
|
|
2018-11-06 11:13:32 +01:00
|
|
|
register({
|
|
|
|
onUpdate: () => store.dispatch(appSet('newVersionAvailable', true))
|
|
|
|
});
|