mue/src/App.jsx

53 lines
1.4 KiB
React
Raw Normal View History

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-08-28 14:34:12 +00:00
import EventBus from 'modules/helpers/eventbus';
2021-08-14 19:10:48 +00:00
export default class App extends PureComponent {
componentDidMount() {
2021-04-17 20:38:16 +00:00
// 4.0 -> 5.0 (the key below is only on 5.0)
// now featuring 5.0 -> 5.1
// the firstRun check was moved here because the old function was useless
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();
}
2021-04-17 20:38:16 +00:00
2021-08-14 19:10:48 +00:00
loadSettings();
EventBus.on('refresh', (data) => {
if (data === 'other') {
2021-08-14 19:10:48 +00:00
loadSettings(true);
}
});
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
}
render() {
2019-09-29 16:46:53 +00:00
return (
<>
{localStorage.getItem('background') === 'true' ? <Background /> : null}
<ToastContainer
position="bottom-right"
autoClose={localStorage.getItem('toastDisplayTime') || 2500}
newestOnTop={true}
closeOnClick
pauseOnFocusLoss
/>
<div id="center">
<Widgets />
<Modals />
</div>
</>
2019-09-29 16:46:53 +00:00
);
}
}