import React from "react"; import Link from "next/link"; import { useRouter } from "next/router"; // hooks import useTheme from "hooks/use-theme"; import { NotificationPopover } from "components/notifications"; const workspaceLinks = (workspaceSlug: string) => [ { icon: "grid_view", name: "Dashboard", href: `/${workspaceSlug}`, }, { icon: "bar_chart", name: "Analytics", href: `/${workspaceSlug}/analytics`, }, { icon: "work", name: "Projects", href: `/${workspaceSlug}/projects`, }, { icon: "task_alt", name: "My Issues", href: `/${workspaceSlug}/me/my-issues`, }, ]; // components import { Icon, Tooltip } from "components/ui"; export const WorkspaceSidebarMenu = () => { const router = useRouter(); const { workspaceSlug } = router.query; // theme context 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}
); })}
); };