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';
|
2020-10-22 11:03:15 +03:00
|
|
|
|
2022-10-28 09:39:26 +03:00
|
|
|
// TODO: Move this videojs sass to the player component.
|
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';
|
2023-01-09 12:06:39 +03:00
|
|
|
import { ReactElement, ReactNode } from 'react';
|
|
|
|
import { NextPage } from 'next';
|
2022-05-26 06:38:40 +03:00
|
|
|
import { RecoilRoot } from 'recoil';
|
2023-01-12 09:43:34 +03:00
|
|
|
import { Router, useRouter } from 'next/router';
|
|
|
|
|
|
|
|
import { AdminLayout } from '../components/layouts/AdminLayout';
|
2020-10-23 02:18:18 +03:00
|
|
|
|
2023-01-09 12:06:39 +03:00
|
|
|
export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
|
|
|
|
getLayout?: (page: ReactElement) => ReactNode;
|
|
|
|
};
|
2022-05-30 07:51:00 +03:00
|
|
|
|
2023-01-09 12:06:39 +03:00
|
|
|
type AppPropsWithLayout = AppProps & {
|
|
|
|
Component: NextPageWithLayout;
|
2022-09-07 10:00:28 +03:00
|
|
|
};
|
2020-10-01 01:12:10 +03:00
|
|
|
|
2023-01-09 12:06:39 +03:00
|
|
|
export default function App({ Component, pageProps }: AppPropsWithLayout) {
|
2023-01-12 09:43:34 +03:00
|
|
|
const router = useRouter() as Router;
|
|
|
|
const isAdminPage = router.pathname.startsWith('/admin');
|
|
|
|
if (isAdminPage) {
|
|
|
|
return <AdminLayout pageProps={pageProps} Component={Component} router={router} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
const layout = Component.getLayout ?? (page => page);
|
2023-01-09 12:06:39 +03:00
|
|
|
|
2023-01-12 09:43:34 +03:00
|
|
|
return layout(
|
2023-01-09 12:06:39 +03:00
|
|
|
<RecoilRoot>
|
|
|
|
<Component {...pageProps} />
|
|
|
|
</RecoilRoot>,
|
|
|
|
);
|
|
|
|
}
|