import { Link } from "@tanstack/react-router";
import { userAccess } from "../../lib/authClient";
import {
	Sidebar,
	SidebarContent,
	SidebarFooter,
	SidebarMenuItem,
	SidebarTrigger,
} from "../ui/sidebar";
import Admin from "./Admin";
import { Header } from "./Header";

export default function SideBarNav() {
	return (
		<div className="flex min-h-screen">
			<Sidebar collapsible="icon">
				<Header />
				<SidebarContent>
					{userAccess(null, ["systemAdmin", "admin"]) && <Admin />}
				</SidebarContent>

				<SidebarFooter>
					<SidebarMenuItem>
						<Link to={"/changelog"}>Changelog</Link>
					</SidebarMenuItem>
					<SidebarTrigger />
				</SidebarFooter>
			</Sidebar>
		</div>
	);
}
