1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-01 22:10:04 +09:00
namae/src/index.tsx

50 lines
1.3 KiB
TypeScript
Raw Normal View History

2020-08-31 08:41:53 +09:00
import { StoreProvider } from 'easy-peasy';
import 'rc-tooltip/assets/bootstrap.css';
import React from 'react';
import ReactDOM from 'react-dom';
2022-03-25 15:24:52 +09:00
import { BrowserRouter } from 'react-router-dom';
2020-08-31 08:41:53 +09:00
import { toast, ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
2022-03-25 15:24:52 +09:00
import { store } from './store';
2021-10-07 19:03:51 +09:00
import { initSentry } from './util/analytics';
2020-08-31 08:41:53 +09:00
import { initCrisp } from './util/crisp';
import './util/i18n';
import { FullScreenSuspense } from './util/suspense';
2019-08-03 13:36:29 +09:00
2020-08-31 08:41:53 +09:00
initSentry();
initCrisp();
2019-09-24 13:55:07 +09:00
ReactDOM.render(
2020-03-26 20:22:06 +09:00
<StoreProvider store={store}>
<FullScreenSuspense>
2022-03-25 15:24:52 +09:00
<BrowserRouter>
2020-03-26 20:22:06 +09:00
<App />
2022-03-25 15:24:52 +09:00
</BrowserRouter>
2020-03-26 20:22:06 +09:00
</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')
2020-08-31 08:41:53 +09:00
);
2019-08-01 01:10:09 +09:00
2020-07-29 13:44:03 +09:00
serviceWorker.register({
onUpdate: (registration) => {
2020-08-31 08:41:53 +09:00
console.log('Update available');
2020-06-19 16:47:47 +09:00
toast.success('New version available! Click here to update.', {
2020-07-29 13:44:03 +09:00
onClose: () => {
2020-08-31 08:41:53 +09:00
window.location.reload();
2020-07-29 13:44:03 +09:00
},
position: 'top-right',
autoClose: false,
closeButton: false,
closeOnClick: true,
2020-08-31 08:41:53 +09:00
});
2020-07-29 13:44:03 +09:00
if (registration && registration.waiting) {
2020-08-31 08:41:53 +09:00
registration.waiting.postMessage({ type: 'SKIP_WAITING' });
2020-07-29 13:44:03 +09:00
}
},
2020-08-31 08:41:53 +09:00
});