import {useState} from "react";
import {Toolbar} from "@mui/material";
import FullPageLayout from "@/layouts/FullPageLayout";
import Header from "@/components/layouts/Dashboard/Header";
import Sidebar from "@/components/layouts/Dashboard/Sidebar";
import Content from "@/components/layouts/Dashboard/Content";

const drawerWidth = 260;

const DashboardLayouts = (props) => {
    const {window} = props;
    const [mobileOpen, setMobileOpen] = useState(false);
    const container =
        window !== undefined ? () => window().document.body : undefined;

    const handleDrawerToggle = () => {
        setMobileOpen(!mobileOpen);
    };

    return (
        <FullPageLayout direction="row">
            <Header
                handleDrawerToggle={handleDrawerToggle}
                drawerWidth={drawerWidth}
            />
            <Sidebar
                container={container}
                mobileOpen={mobileOpen}
                handleDrawerToggle={handleDrawerToggle}
                drawerWidth={drawerWidth}
            />
            <FullPageLayout
                component="main"
                sx={{flexGrow: 1, width: {sm: `calc(100% - ${drawerWidth}px)`}}}
            >
                <Toolbar/>
                <Content {...props}/>
            </FullPageLayout>
        </FullPageLayout>
    );
};

export default DashboardLayouts;
