2022-05-27 08:23:43 +03:00
|
|
|
// All these imports are almost exclusively for the Admin.
|
|
|
|
// We should not be loading them for the main frontend UI.
|
|
|
|
|
2021-02-04 20:17:20 +03:00
|
|
|
// order matters!
|
2022-05-07 09:32:33 +03:00
|
|
|
import '../styles/variables.css';
|
2022-04-20 00:33:43 +03:00
|
|
|
import '../styles/global.less';
|
|
|
|
import '../styles/globals.scss';
|
2022-07-01 23:49:42 +03:00
|
|
|
import '../styles/ant-overrides.scss';
|
2022-05-27 08:23:43 +03:00
|
|
|
// import '../styles/markdown-editor.scss';
|
2021-02-04 20:17:20 +03:00
|
|
|
|
|
|
|
import '../styles/main-layout.scss';
|
2020-11-13 14:43:28 +03:00
|
|
|
|
2021-02-04 19:04:00 +03:00
|
|
|
import '../styles/form-textfields.scss';
|
|
|
|
import '../styles/form-misc-elements.scss';
|
|
|
|
import '../styles/config-socialhandles.scss';
|
|
|
|
import '../styles/config-storage.scss';
|
2021-07-26 08:12:50 +03:00
|
|
|
import '../styles/config-edit-string-tags.scss';
|
2021-02-04 19:04:00 +03:00
|
|
|
import '../styles/config-video-variants.scss';
|
2021-02-13 10:55:59 +03:00
|
|
|
import '../styles/config-public-details.scss';
|
2021-02-04 19:04:00 +03:00
|
|
|
|
2020-11-13 14:43:28 +03:00
|
|
|
import '../styles/home.scss';
|
2020-12-23 10:15:37 +03:00
|
|
|
import '../styles/chat.scss';
|
2021-02-14 12:30:42 +03:00
|
|
|
import '../styles/pages.scss';
|
2021-05-28 01:58:31 +03:00
|
|
|
import '../styles/offline-notice.scss';
|
2020-10-22 11:03:15 +03:00
|
|
|
|
2022-09-07 10:00:28 +03:00
|
|
|
import '../components/video/VideoJS/VideoJS.scss';
|
2022-05-27 07:44:54 +03:00
|
|
|
|
2020-10-23 02:18:18 +03:00
|
|
|
import { AppProps } from 'next/app';
|
2022-05-12 09:31:31 +03:00
|
|
|
import { Router, useRouter } from 'next/router';
|
2021-02-04 10:24:12 +03:00
|
|
|
|
2022-05-26 06:38:40 +03:00
|
|
|
import { RecoilRoot } from 'recoil';
|
2022-05-30 07:51:00 +03:00
|
|
|
import { useEffect } from 'react';
|
2022-09-07 10:00:28 +03:00
|
|
|
import { AdminLayout } from '../components/layouts/AdminLayout';
|
|
|
|
import { SimpleLayout } from '../components/layouts/SimpleLayout';
|
2020-10-23 02:18:18 +03:00
|
|
|
|
2022-09-07 10:00:28 +03:00
|
|
|
const App = ({ Component, pageProps }: AppProps) => {
|
2022-05-30 07:51:00 +03:00
|
|
|
useEffect(() => {
|
|
|
|
if ('serviceWorker' in navigator) {
|
|
|
|
window.addEventListener('load', () => {
|
|
|
|
navigator.serviceWorker.register('/serviceWorker.js').then(
|
|
|
|
registration => {
|
|
|
|
console.debug(
|
|
|
|
'Service Worker registration successful with scope: ',
|
|
|
|
registration.scope,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
err => {
|
|
|
|
console.error('Service Worker registration failed: ', err);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, []);
|
|
|
|
|
2022-05-12 09:31:31 +03:00
|
|
|
const router = useRouter() as Router;
|
2022-04-20 05:57:27 +03:00
|
|
|
if (router.pathname.startsWith('/admin')) {
|
|
|
|
return <AdminLayout pageProps={pageProps} Component={Component} router={router} />;
|
|
|
|
}
|
2022-05-26 06:38:40 +03:00
|
|
|
return (
|
|
|
|
<RecoilRoot>
|
|
|
|
<SimpleLayout pageProps={pageProps} Component={Component} router={router} />
|
|
|
|
</RecoilRoot>
|
|
|
|
);
|
2022-09-07 10:00:28 +03:00
|
|
|
};
|
2020-10-01 01:12:10 +03:00
|
|
|
|
2021-01-31 12:38:20 +03:00
|
|
|
export default App;
|