diff --git a/web/components/headers/cycle-issues.tsx b/web/components/headers/cycle-issues.tsx index e5b1167b2..241259648 100644 --- a/web/components/headers/cycle-issues.tsx +++ b/web/components/headers/cycle-issues.tsx @@ -192,20 +192,23 @@ export const CycleIssuesHeader: React.FC = observer(() => { handleDisplayPropertiesUpdate={handleDisplayProperties} /> - setAnalyticsModal(true)} variant="neutral-primary" size="sm"> - Analytics - + {canUserCreateIssue && ( - { - setTrackElement("CYCLE_PAGE_HEADER"); - commandPaletteStore.toggleCreateIssueModal(true, EProjectStore.CYCLE); - }} - size="sm" - prependIcon={} - > - Add Issue - + <> + setAnalyticsModal(true)} variant="neutral-primary" size="sm"> + Analytics + + { + setTrackElement("CYCLE_PAGE_HEADER"); + commandPaletteStore.toggleCreateIssueModal(true, EProjectStore.CYCLE); + }} + size="sm" + prependIcon={} + > + Add Issue + + > )} { handleDisplayPropertiesUpdate={handleDisplayProperties} /> - setAnalyticsModal(true)} variant="neutral-primary" size="sm"> - Analytics - + {canUserCreateIssue && ( - { - setTrackElement("MODULE_PAGE_HEADER"); - commandPaletteStore.toggleCreateIssueModal(true, EProjectStore.MODULE); - }} - size="sm" - prependIcon={} - > - Add Issue - + <> + setAnalyticsModal(true)} variant="neutral-primary" size="sm"> + Analytics + + { + setTrackElement("MODULE_PAGE_HEADER"); + commandPaletteStore.toggleCreateIssueModal(true, EProjectStore.MODULE); + }} + size="sm" + prependIcon={} + > + Add Issue + + > )} { )} - setAnalyticsModal(true)} variant="neutral-primary" size="sm"> - Analytics - + {canUserCreateIssue && ( - { - setTrackElement("PROJECT_PAGE_HEADER"); - commandPaletteStore.toggleCreateIssueModal(true, EProjectStore.PROJECT); - }} - size="sm" - prependIcon={} - > - Add Issue - + <> + setAnalyticsModal(true)} variant="neutral-primary" size="sm"> + Analytics + + { + setTrackElement("PROJECT_PAGE_HEADER"); + commandPaletteStore.toggleCreateIssueModal(true, EProjectStore.PROJECT); + }} + size="sm" + prependIcon={} + > + Add Issue + + > )} diff --git a/web/components/workspace/sidebar-menu.tsx b/web/components/workspace/sidebar-menu.tsx index 792e7e6a0..573b10541 100644 --- a/web/components/workspace/sidebar-menu.tsx +++ b/web/components/workspace/sidebar-menu.tsx @@ -9,6 +9,8 @@ import { BarChart2, Briefcase, CheckCircle, LayoutGrid } from "lucide-react"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; import { observer } from "mobx-react-lite"; +// constants +import { EUserWorkspaceRoles } from "constants/workspace"; const workspaceLinks = (workspaceSlug: string) => [ { @@ -34,16 +36,21 @@ const workspaceLinks = (workspaceSlug: string) => [ ]; export const WorkspaceSidebarMenu = observer(() => { - const { theme: themeStore } = useMobxStore(); + const { + theme: themeStore, + user: { currentWorkspaceRole }, + } = useMobxStore(); // router const router = useRouter(); const { workspaceSlug } = router.query; + const isAuthorizedUser = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER; + return ( {workspaceLinks(workspaceSlug as string).map((link, index) => { const isActive = link.name === "Settings" ? router.asPath.includes(link.href) : router.asPath === link.href; - + if (!isAuthorizedUser && link.name === "Analytics") return; return (