2021-11-16 22:52:23 +01:00
|
|
|
import "../styles/globals.css";
|
|
|
|
import Head from "next/head";
|
|
|
|
import { Provider, useSession } from "next-auth/client";
|
|
|
|
import { ChakraProvider } from "@chakra-ui/react";
|
|
|
|
import Header from "../components/Nav/Header";
|
|
|
|
import theme from "../chakra_config/theme";
|
|
|
|
import { ColorModeScript } from "@chakra-ui/react";
|
|
|
|
import Sidebar from "../components/Sidebar/Sidebar";
|
2021-06-21 16:12:57 +02:00
|
|
|
|
2022-01-08 22:38:17 +01:00
|
|
|
export default function MyApp({ Component, pageProps }) {
|
2021-11-16 22:52:23 +01:00
|
|
|
const [session, loading] = useSession();
|
2021-07-05 11:41:32 +02:00
|
|
|
|
2021-06-21 16:12:57 +02:00
|
|
|
return (
|
|
|
|
<Provider>
|
2021-06-27 12:44:22 +02:00
|
|
|
<ChakraProvider>
|
|
|
|
<Head>
|
|
|
|
<title>Cath Dashboard</title>
|
2021-07-05 11:41:32 +02:00
|
|
|
<link rel="icon" href="/logo.png" type="image/png" />
|
2021-06-27 12:44:22 +02:00
|
|
|
</Head>
|
|
|
|
<ColorModeScript initialColorMode={theme.config.initialColorMode} />
|
2021-11-16 22:52:23 +01:00
|
|
|
{!session && (
|
|
|
|
<Sidebar>
|
|
|
|
<div className="page-container">
|
|
|
|
<Component {...pageProps} />
|
|
|
|
</div>
|
|
|
|
</Sidebar>
|
|
|
|
)}
|
|
|
|
{session && (
|
|
|
|
<>
|
|
|
|
<Header />
|
|
|
|
<div className="page-container">
|
|
|
|
<Component {...pageProps} />
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
)}
|
2021-06-27 12:44:22 +02:00
|
|
|
</ChakraProvider>
|
2021-06-21 16:12:57 +02:00
|
|
|
</Provider>
|
2021-11-16 22:52:23 +01:00
|
|
|
);
|
2021-06-21 16:12:57 +02:00
|
|
|
}
|