/* This App component is the top-level component which will be common across all the different pages. 
You can use this App component to keep state when navigating between pages, for example. */
import { VStack, Box, Spacer } from "@chakra-ui/react";
import React from "react";
import ThemeWrapper from "shared/components/ThemeWrapper";
import Navbar from "../components/Navbar";
import { useRouter } from "next/router";
import DashboardWrapper from "dashboard/src/wrapper";
import { CookiesProvider } from "react-cookie";

export default function App({ Component, pageProps }) {
  const router = useRouter();

  return (
    <ThemeWrapper {...pageProps} isDashboard>
      <DashboardWrapper>
        <VStack align={"unset"} w={"100%"} minH={"100vh"}>
          <Navbar {...pageProps} isIndex={router.route === "/"} />
          <Box alignItems={"center"} mt={"0 !important"}>
            <CookiesProvider>
              <Component {...pageProps} />
            </CookiesProvider>
          </Box>
          <Spacer />
        </VStack>
      </DashboardWrapper>
    </ThemeWrapper>
  );
}
