import React from "react"; import Link from "next/link"; import { useRouter } from "next/router"; // hooks import useTheme from "hooks/use-theme"; // components import { NotificationPopover } from "components/notifications"; // ui import { Tooltip } from "components/ui"; // icons import { BarChartRounded, GridViewOutlined, TaskAltOutlined, WorkOutlineOutlined, } from "@mui/icons-material"; const workspaceLinks = (workspaceSlug: string) => [ { Icon: GridViewOutlined, name: "Dashboard", href: `/${workspaceSlug}`, }, { Icon: BarChartRounded, name: "Analytics", href: `/${workspaceSlug}/analytics`, }, { Icon: WorkOutlineOutlined, name: "Projects", href: `/${workspaceSlug}/projects`, }, { Icon: TaskAltOutlined, name: "My Issues", href: `/${workspaceSlug}/me/my-issues`, }, ]; export const WorkspaceSidebarMenu = () => { const router = useRouter(); const { workspaceSlug } = router.query; const { collapsed: sidebarCollapse } = useTheme(); return (
{workspaceLinks(workspaceSlug as string).map((link, index) => { const isActive = link.name === "Settings" ? router.asPath.includes(link.href) : router.asPath === link.href; return (
{} {!sidebarCollapse && link.name}
); })}
); };