import React from "react"; import { observer } from "mobx-react-lite"; import Link from "next/link"; import { useRouter } from "next/router"; import { Crown } from "lucide-react"; // ui import { Tooltip } from "@plane/ui"; // components import { NotificationPopover } from "@/components/notifications"; // constants import { SIDEBAR_MENU_ITEMS } from "@/constants/dashboard"; import { SIDEBAR_CLICKED } from "@/constants/event-tracker"; import { EUserWorkspaceRoles } from "@/constants/workspace"; // helper import { cn } from "@/helpers/common.helper"; // hooks import { useApplication, useEventTracker, useUser } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; export const WorkspaceSidebarMenu = observer(() => { // store hooks const { theme: themeStore } = useApplication(); const { captureEvent } = useEventTracker(); const { isMobile } = usePlatformOS(); const { membership: { currentWorkspaceRole }, } = useUser(); // router const router = useRouter(); const { workspaceSlug } = router.query; // computed const workspaceMemberInfo = currentWorkspaceRole || EUserWorkspaceRoles.GUEST; const handleLinkClick = (itemKey: string) => { if (window.innerWidth < 768) { themeStore.toggleSidebar(); } captureEvent(SIDEBAR_CLICKED, { destination: itemKey, }); }; return (
{SIDEBAR_MENU_ITEMS.map( (link) => workspaceMemberInfo >= link.access && ( handleLinkClick(link.key)}>
{ } {!themeStore?.sidebarCollapsed &&

{link.label}

} {!themeStore?.sidebarCollapsed && link.key === "active-cycles" && ( )}
) )}
); });