1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-02 06:20:02 +09:00
namae/src/index.tsx

58 lines
1.5 KiB
TypeScript
Raw Normal View History

2020-06-29 12:24:01 +09:00
import { StoreProvider } from 'easy-peasy';
import { createBrowserHistory } from 'history';
import 'rc-tooltip/assets/bootstrap.css';
2019-09-17 14:30:26 +09:00
import React from 'react';
import ReactDOM from 'react-dom';
2020-06-29 12:24:01 +09:00
import { Router } from 'react-router-dom';
2020-07-29 13:44:03 +09:00
import { toast, ToastContainer } from 'react-toastify';
2020-06-19 16:47:47 +09:00
import 'react-toastify/dist/ReactToastify.css';
2019-09-17 14:30:26 +09:00
import App from './App';
import * as serviceWorker from './serviceWorker';
2020-06-29 12:24:01 +09:00
import { store, wrapHistoryWithStoreHandler } from './store';
import { initSentry, wrapHistoryWithGA } from './util/analytics';
import { compose } from './util/array';
2020-07-29 13:44:03 +09:00
import { initCrisp } from './util/crisp';
2019-09-17 14:30:26 +09:00
import './util/i18n';
2020-06-29 12:24:01 +09:00
import { FullScreenSuspense } from './util/suspense';
2019-08-03 13:36:29 +09:00
2019-09-24 13:55:07 +09:00
initSentry();
initCrisp();
2019-09-24 13:55:07 +09:00
2020-03-27 00:49:23 +09:00
const history = compose(
createBrowserHistory(),
wrapHistoryWithStoreHandler,
wrapHistoryWithGA,
);
2020-03-06 00:35:37 +09:00
2019-09-24 13:55:07 +09:00
ReactDOM.render(
2020-03-26 20:22:06 +09:00
<StoreProvider store={store}>
<FullScreenSuspense>
<Router history={history}>
<App />
</Router>
</FullScreenSuspense>
2020-06-19 16:47:47 +09:00
<ToastContainer />
2020-03-26 20:22:06 +09:00
</StoreProvider>,
2019-09-24 13:55:07 +09:00
document.getElementById('root'),
2019-09-17 14:30:26 +09:00
);
2019-08-01 01:10:09 +09:00
2020-07-29 13:44:03 +09:00
serviceWorker.register({
onUpdate: (registration) => {
console.log('Update available');
2020-06-19 16:47:47 +09:00
2020-07-29 13:44:03 +09:00
toast.dark('New version available! Click here to update.', {
onClose: () => {
window.location.reload();
},
position: 'top-right',
autoClose: false,
closeButton: false,
closeOnClick: true,
});
if (registration && registration.waiting) {
registration.waiting.postMessage({ type: 'SKIP_WAITING' });
}
},
});