import React from "react"; import { useRouter } from "next/router"; import Link from "next/link"; // hooks import useTheme from "hooks/use-theme"; // components import { Icon, Tooltip } from "components/ui"; export const WorkspaceSidebarMenu = () => { const router = useRouter(); const { workspaceSlug } = router.query; // theme context const { collapsed: sidebarCollapse } = useTheme(); 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`, }, { icon: "settings", name: "Settings", href: `/${workspaceSlug}/settings`, }, ]; 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}
); })}
); };