[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:
parent
5244ba72c9
commit
861a1c4132
7 changed files with 179 additions and 101 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue