import * as React from "react" import Image from "next/image" import { AppWindow, Settings, LayoutDashboardIcon, Briefcase, Server, Network, Activity } from "lucide-react" import { Sidebar, SidebarContent, SidebarGroup, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarRail, } from "@/components/ui/sidebar" import { Button } from "@/components/ui/button" import Link from "next/link" import Cookies from "js-cookie" import { useRouter } from "next/navigation" import packageJson from "@/package.json" interface NavItem { title: string icon?: React.ComponentType url: string isActive?: boolean items?: NavItem[] } const data: { navMain: NavItem[] } = { navMain: [ { title: "Dashboard", icon: LayoutDashboardIcon, url: "/dashboard" }, { title: "My Infrastructure", url: "#", icon: Briefcase, items: [ { title: "Servers", icon: Server, url: "/dashboard/servers", }, { title: "Applications", icon: AppWindow, url: "/dashboard/applications", }, { title: "Activity", icon: Activity, url: "/dashboard/activity", }, { title: "Network", icon: Network, url: "/dashboard/network", }, ], }, { title: "Settings", icon: Settings, url: "/dashboard/settings", }, ], } export function AppSidebar({ ...props }: React.ComponentProps) { const router = useRouter() const logout = async () => { Cookies.remove('token') router.push("/") } return ( Logo
CoreControl v{packageJson.version}
{data.navMain.map((item) => ( {item.icon && } {item.title} {item.items?.length && ( {item.items.map((subItem) => ( {subItem.icon && } {subItem.title} ))} )} ))}
) }