2024-04-01 21:34:52 +03:00
|
|
|
import { Link, Outlet } from "react-router-dom";
|
|
|
|
|
import { Toaster } from "@/components/ui/toaster";
|
|
|
|
|
import { SideNav } from "./SideNav";
|
2024-08-26 21:31:42 +03:00
|
|
|
import { PinLeftIcon, PinRightIcon } from "@radix-ui/react-icons";
|
2024-04-07 21:52:59 +03:00
|
|
|
import { Logo } from "@/components/Logo";
|
2024-07-24 05:22:16 -07:00
|
|
|
import { cn } from "@/util/utils";
|
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import { LogoMinimized } from "@/components/LogoMinimized";
|
2024-08-26 21:31:42 +03:00
|
|
|
import { Header } from "./Header";
|
2024-09-18 16:03:19 +03:00
|
|
|
import { useSidebarStore } from "@/store/SidebarStore";
|
2024-04-15 11:54:12 -07:00
|
|
|
|
2024-05-07 11:31:05 -07:00
|
|
|
function RootLayout() {
|
2024-09-18 16:03:19 +03:00
|
|
|
const { collapsed, setCollapsed } = useSidebarStore();
|
2024-04-01 21:34:52 +03:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2024-07-24 05:22:16 -07:00
|
|
|
<div className="h-full w-full">
|
|
|
|
|
<aside
|
|
|
|
|
className={cn("fixed h-screen min-h-screen border-r-2 px-6", {
|
2024-09-18 16:03:19 +03:00
|
|
|
"w-64": !collapsed,
|
|
|
|
|
"w-28": collapsed,
|
2024-07-24 05:22:16 -07:00
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex h-full flex-col">
|
|
|
|
|
<Link to={window.location.origin}>
|
|
|
|
|
<div className="flex h-24 items-center">
|
2024-09-18 16:03:19 +03:00
|
|
|
{collapsed ? <LogoMinimized /> : <Logo />}
|
2024-07-24 05:22:16 -07:00
|
|
|
</div>
|
|
|
|
|
</Link>
|
2024-09-18 16:03:19 +03:00
|
|
|
<SideNav collapsed={collapsed} />
|
2024-07-24 05:22:16 -07:00
|
|
|
<div
|
|
|
|
|
className={cn("mt-auto flex min-h-16", {
|
2024-09-18 16:03:19 +03:00
|
|
|
"justify-center": collapsed,
|
|
|
|
|
"justify-end": !collapsed,
|
2024-07-24 05:22:16 -07:00
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
size="icon"
|
|
|
|
|
variant="ghost"
|
|
|
|
|
onClick={() => {
|
2024-09-18 16:03:19 +03:00
|
|
|
setCollapsed(!collapsed);
|
2024-07-24 05:22:16 -07:00
|
|
|
}}
|
|
|
|
|
>
|
2024-09-18 16:03:19 +03:00
|
|
|
{collapsed ? (
|
2024-07-24 05:22:16 -07:00
|
|
|
<PinRightIcon className="h-6 w-6" />
|
|
|
|
|
) : (
|
|
|
|
|
<PinLeftIcon className="h-6 w-6" />
|
|
|
|
|
)}
|
|
|
|
|
</Button>
|
2024-04-15 11:54:12 -07:00
|
|
|
</div>
|
2024-07-24 05:22:16 -07:00
|
|
|
</div>
|
2024-04-01 21:34:52 +03:00
|
|
|
</aside>
|
2024-08-26 21:31:42 +03:00
|
|
|
<Header />
|
2024-07-24 05:22:16 -07:00
|
|
|
<main
|
|
|
|
|
className={cn("pb-4 pl-64", {
|
2024-09-18 16:03:19 +03:00
|
|
|
"pl-28": collapsed,
|
2024-07-24 05:22:16 -07:00
|
|
|
})}
|
|
|
|
|
>
|
2024-04-01 21:34:52 +03:00
|
|
|
<Outlet />
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
<Toaster />
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export { RootLayout };
|