2023-06-26 10:07:12 +00:00
|
|
|
"use client";
|
|
|
|
|
|
2023-05-24 20:27:57 +00:00
|
|
|
import { FC, PropsWithChildren } from "react";
|
2023-05-25 12:37:14 +00:00
|
|
|
import getConfig from "next/config";
|
2023-02-13 13:46:56 +00:00
|
|
|
import { Grid, Container } from "@mui/material";
|
|
|
|
|
import CookieConsent from "react-cookie-consent";
|
|
|
|
|
import { useCookies } from "react-cookie";
|
|
|
|
|
import { TopNav } from "./TopNav";
|
|
|
|
|
import { Sidebar } from "./Sidebar";
|
2024-06-05 08:52:41 +02:00
|
|
|
import { GettingStartedDialog } from "@link-stack/leafcutter-ui";
|
|
|
|
|
import { useLeafcutterContext } from "@link-stack/leafcutter-ui/components/LeafcutterProvider";
|
2023-02-13 13:46:56 +00:00
|
|
|
// import { Footer } from "./Footer";
|
|
|
|
|
|
2023-06-20 07:49:52 +00:00
|
|
|
type LayoutProps = PropsWithChildren<{
|
|
|
|
|
embedded?: boolean;
|
|
|
|
|
}>;
|
|
|
|
|
|
2023-06-26 10:07:12 +00:00
|
|
|
export const InternalLayout: FC<LayoutProps> = ({
|
2023-06-20 07:49:52 +00:00
|
|
|
embedded = false,
|
|
|
|
|
children,
|
|
|
|
|
}: any) => {
|
2023-02-13 13:46:56 +00:00
|
|
|
const [cookies, setCookie] = useCookies(["cookieConsent"]);
|
|
|
|
|
const consentGranted = cookies.cookieConsent === "true";
|
|
|
|
|
const {
|
|
|
|
|
colors: {
|
|
|
|
|
white,
|
|
|
|
|
almostBlack,
|
|
|
|
|
leafcutterElectricBlue,
|
|
|
|
|
cdrLinkOrange,
|
|
|
|
|
helpYellow,
|
|
|
|
|
},
|
2024-03-20 17:51:21 +01:00
|
|
|
} = useLeafcutterContext();
|
2023-02-13 13:46:56 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Grid container direction="column">
|
2023-05-25 12:37:14 +00:00
|
|
|
{!embedded && (
|
|
|
|
|
<Grid item>
|
|
|
|
|
<TopNav />
|
|
|
|
|
</Grid>
|
|
|
|
|
)}
|
|
|
|
|
{!embedded && <Sidebar open />}
|
|
|
|
|
<Grid
|
|
|
|
|
item
|
|
|
|
|
sx={{ mt: embedded ? 0 : "100px", ml: embedded ? 0 : "310px" }}
|
|
|
|
|
>
|
2023-02-13 13:46:56 +00:00
|
|
|
<Container sx={{ padding: 2 }}>{children}</Container>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
{!consentGranted ? (
|
|
|
|
|
<CookieConsent
|
|
|
|
|
style={{
|
|
|
|
|
zIndex: 1500,
|
|
|
|
|
backgroundColor: helpYellow,
|
|
|
|
|
color: almostBlack,
|
|
|
|
|
borderTop: `1px solid ${leafcutterElectricBlue}`,
|
|
|
|
|
}}
|
|
|
|
|
onAccept={() => setCookie("cookieConsent", "true", { path: "/" })}
|
|
|
|
|
buttonStyle={{
|
|
|
|
|
borderRadius: 500,
|
|
|
|
|
backgroundColor: cdrLinkOrange,
|
|
|
|
|
color: white,
|
|
|
|
|
textTransform: "uppercase",
|
|
|
|
|
padding: "10px 20px",
|
|
|
|
|
fontWeight: "bold",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Leafcutter uses cookies for core funtionality.
|
|
|
|
|
</CookieConsent>
|
|
|
|
|
) : null}
|
|
|
|
|
<GettingStartedDialog />
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|