diff --git a/web/components/headers/global-issues.tsx b/web/components/headers/global-issues.tsx index a3a34f1fc..ef4c2b3f5 100644 --- a/web/components/headers/global-issues.tsx +++ b/web/components/headers/global-issues.tsx @@ -16,6 +16,7 @@ import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOption // constants import { ISSUE_DISPLAY_FILTERS_BY_LAYOUT } from "constants/issue"; import { EFilterType } from "store/issues/types"; +import { EUserWorkspaceRoles } from "constants/workspace"; const GLOBAL_VIEW_LAYOUTS = [ { key: "list", title: "List", link: "/workspace-views", icon: List }, @@ -38,7 +39,7 @@ export const GlobalIssuesHeader: React.FC = observer((props) => { workspace: { workspaceLabels }, workspaceMember: { workspaceMembers }, project: { workspaceProjects }, - + user: { currentWorkspaceRole }, workspaceGlobalIssuesFilter: { issueFilters, updateFilters }, } = useMobxStore(); @@ -77,6 +78,8 @@ export const GlobalIssuesHeader: React.FC = observer((props) => { [workspaceSlug, updateFilters] ); + const isAuthorizedUser = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER; + return ( <> setCreateViewModal(false)} /> @@ -142,10 +145,11 @@ export const GlobalIssuesHeader: React.FC = observer((props) => { )} - - + {isAuthorizedUser && ( + + )} diff --git a/web/components/headers/projects.tsx b/web/components/headers/projects.tsx index 2ba0c0184..370dfe6d4 100644 --- a/web/components/headers/projects.tsx +++ b/web/components/headers/projects.tsx @@ -5,6 +5,8 @@ import { Breadcrumbs, Button } from "@plane/ui"; // hooks import { useMobxStore } from "lib/mobx/store-provider"; import { observer } from "mobx-react-lite"; +// constants +import { EUserWorkspaceRoles } from "constants/workspace"; export const ProjectsHeader = observer(() => { const router = useRouter(); @@ -15,10 +17,13 @@ export const ProjectsHeader = observer(() => { project: projectStore, commandPalette: commandPaletteStore, trackEvent: { setTrackElement }, + user: { currentWorkspaceRole }, } = useMobxStore(); const projectsList = workspaceSlug ? projectStore.projects[workspaceSlug.toString()] : []; + const isAuthorizedUser = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER; + return (
@@ -44,17 +49,18 @@ export const ProjectsHeader = observer(() => { />
)} - - + {isAuthorizedUser && ( + + )}
); diff --git a/web/components/project/sidebar-list.tsx b/web/components/project/sidebar-list.tsx index 5f3bf3506..6c9054ac0 100644 --- a/web/components/project/sidebar-list.tsx +++ b/web/components/project/sidebar-list.tsx @@ -17,6 +17,8 @@ import { orderArrayBy } from "helpers/array.helper"; import { IProject } from "types"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; +// constants +import { EUserWorkspaceRoles } from "constants/workspace"; export const ProjectSidebarList: FC = observer(() => { // states @@ -31,6 +33,7 @@ export const ProjectSidebarList: FC = observer(() => { project: { joinedProjects, favoriteProjects, orderProjectsWithSortOrder, updateProjectView }, commandPalette: { toggleCreateProjectModal }, trackEvent: { setTrackElement }, + user: { currentWorkspaceRole }, } = useMobxStore(); // router const router = useRouter(); @@ -39,6 +42,8 @@ export const ProjectSidebarList: FC = observer(() => { // toast const { setToastAlert } = useToast(); + const isAuthorizedUser = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER; + const orderedJoinedProjects: IProject[] | undefined = joinedProjects ? orderArrayBy(joinedProjects, "sort_order", "ascending") : undefined; @@ -138,16 +143,18 @@ export const ProjectSidebarList: FC = observer(() => { )} - + {isAuthorizedUser && ( + + )} )} { )} - + {isAuthorizedUser && ( + + )} )} { - {joinedProjects && joinedProjects.length === 0 && ( + {isAuthorizedUser && joinedProjects && joinedProjects.length === 0 && (