2021-09-28 22:04:04 +00:00
|
|
|
import variables from 'modules/variables';
|
2021-08-14 19:10:48 +00:00
|
|
|
import { PureComponent } from 'react';
|
2021-08-15 21:28:37 +00:00
|
|
|
import { ToastContainer } from 'react-toastify';
|
2020-09-14 19:48:58 +00:00
|
|
|
|
2021-08-28 14:34:12 +00:00
|
|
|
import Background from 'components/widgets/background/Background';
|
|
|
|
import Widgets from 'components/widgets/Widgets';
|
|
|
|
import Modals from 'components/modals/Modals';
|
2020-09-14 19:48:58 +00:00
|
|
|
|
2021-08-28 14:34:12 +00:00
|
|
|
import { loadSettings, moveSettings } from 'modules/helpers/settings';
|
2021-04-12 17:55:02 +00:00
|
|
|
|
2021-08-28 14:34:12 +00:00
|
|
|
import EventBus from 'modules/helpers/eventbus';
|
2020-07-18 21:00:34 +00:00
|
|
|
|
2021-08-14 19:10:48 +00:00
|
|
|
export default class App extends PureComponent {
|
2020-10-17 17:46:27 +00:00
|
|
|
componentDidMount() {
|
2021-04-17 20:38:16 +00:00
|
|
|
// 4.0 -> 5.0 (the key below is only on 5.0)
|
2021-06-20 12:09:41 +00:00
|
|
|
// now featuring 5.0 -> 5.1
|
2021-07-02 20:29:33 +00:00
|
|
|
// the firstRun check was moved here because the old function was useless
|
2021-07-06 18:38:20 +00:00
|
|
|
if (!localStorage.getItem('firstRun') || !localStorage.getItem('stats')) {
|
2021-08-14 19:10:48 +00:00
|
|
|
moveSettings();
|
2021-04-17 20:38:16 +00:00
|
|
|
window.location.reload();
|
2022-04-11 21:57:07 +00:00
|
|
|
}
|
2021-04-17 20:38:16 +00:00
|
|
|
|
2021-08-14 19:10:48 +00:00
|
|
|
loadSettings();
|
2021-04-12 19:35:17 +00:00
|
|
|
|
|
|
|
EventBus.on('refresh', (data) => {
|
|
|
|
if (data === 'other') {
|
2021-08-14 19:10:48 +00:00
|
|
|
loadSettings(true);
|
2021-04-12 19:35:17 +00:00
|
|
|
}
|
|
|
|
});
|
2021-06-21 16:42:14 +00:00
|
|
|
|
2021-09-28 22:04:04 +00:00
|
|
|
variables.stats.tabLoad();
|
2020-11-04 12:19:12 +00:00
|
|
|
}
|
|
|
|
|
2020-10-17 17:46:27 +00:00
|
|
|
render() {
|
2019-09-29 16:46:53 +00:00
|
|
|
return (
|
2021-03-22 22:17:52 +00:00
|
|
|
<>
|
2022-04-11 21:57:07 +00:00
|
|
|
{localStorage.getItem('background') === 'true' ? <Background /> : null}
|
|
|
|
<ToastContainer
|
|
|
|
position="bottom-right"
|
|
|
|
autoClose={localStorage.getItem('toastDisplayTime') || 2500}
|
|
|
|
newestOnTop={true}
|
|
|
|
closeOnClick
|
|
|
|
pauseOnFocusLoss
|
|
|
|
/>
|
|
|
|
<div id="center">
|
|
|
|
<Widgets />
|
|
|
|
<Modals />
|
2020-07-15 20:06:21 +00:00
|
|
|
</div>
|
2021-03-22 22:17:52 +00:00
|
|
|
</>
|
2019-09-29 16:46:53 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|