[WEB-738] chore: conditionally render projects in the dropdown (#3952)

* chore: show authorized projects in the dropdown

* refactor: command palette logic

* chore: add helper function to check for project role

* fix: add preventDefault for shortcuts
This commit is contained in:
Aaryan Khandelwal 2024-03-15 17:44:01 +05:30 committed by GitHub
parent 5244ba72c9
commit 861a1c4132
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 179 additions and 101 deletions

View file

@ -3,6 +3,8 @@ import sortBy from "lodash/sortBy";
import { satisfiesDateFilter } from "helpers/filter.helper";
// types
import { IProject, TProjectDisplayFilters, TProjectFilters, TProjectOrderByOptions } from "@plane/types";
// constants
import { EUserProjectRoles } from "constants/project";
/**
* Updates the sort order of the project.
@ -51,6 +53,14 @@ export const orderJoinedProjects = (
export const projectIdentifierSanitizer = (identifier: string): string =>
identifier.replace(/[^ÇŞĞIİÖÜA-Za-z0-9]/g, "");
/**
* @description Checks if the project should be rendered or not based on the user role
* @param {IProject} project
* @returns {boolean}
*/
export const shouldRenderProject = (project: IProject): boolean =>
!!project.member_role && project.member_role >= EUserProjectRoles.MEMBER;
/**
* @description filters projects based on the filter
* @param {IProject} project