2020-08-20 00:57:33 +09:00
|
|
|
import { StoreProvider } from 'easy-peasy'
|
|
|
|
import { createBrowserHistory } from 'history'
|
|
|
|
import 'rc-tooltip/assets/bootstrap.css'
|
|
|
|
import React from 'react'
|
|
|
|
import ReactDOM from 'react-dom'
|
|
|
|
import { Router } from 'react-router-dom'
|
|
|
|
import { toast, ToastContainer } from 'react-toastify'
|
|
|
|
import 'react-toastify/dist/ReactToastify.css'
|
|
|
|
import App from './App'
|
|
|
|
import * as serviceWorker from './serviceWorker'
|
|
|
|
import { store, wrapHistoryWithStoreHandler } from './store'
|
|
|
|
import { initSentry, wrapHistoryWithGA } from './util/analytics'
|
|
|
|
import { compose } from './util/array'
|
|
|
|
import { initCrisp } from './util/crisp'
|
|
|
|
import './util/i18n'
|
|
|
|
import { FullScreenSuspense } from './util/suspense'
|
2019-08-03 13:36:29 +09:00
|
|
|
|
2020-08-20 00:57:33 +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,
|
2020-08-20 00:57:33 +09:00
|
|
|
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>,
|
2020-08-20 00:57:33 +09:00
|
|
|
document.getElementById('root')
|
|
|
|
)
|
2019-08-01 01:10:09 +09:00
|
|
|
|
2020-07-29 13:44:03 +09:00
|
|
|
serviceWorker.register({
|
|
|
|
onUpdate: (registration) => {
|
2020-08-20 00:57:33 +09:00
|
|
|
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: () => {
|
2020-08-20 00:57:33 +09:00
|
|
|
window.location.reload()
|
2020-07-29 13:44:03 +09:00
|
|
|
},
|
|
|
|
position: 'top-right',
|
|
|
|
autoClose: false,
|
|
|
|
closeButton: false,
|
|
|
|
closeOnClick: true,
|
2020-08-20 00:57:33 +09:00
|
|
|
})
|
2020-07-29 13:44:03 +09:00
|
|
|
|
|
|
|
if (registration && registration.waiting) {
|
2020-08-20 00:57:33 +09:00
|
|
|
registration.waiting.postMessage({ type: 'SKIP_WAITING' })
|
2020-07-29 13:44:03 +09:00
|
|
|
}
|
|
|
|
},
|
2020-08-20 00:57:33 +09:00
|
|
|
})
|