improvement: filterable role selection on create/edit group

This commit is contained in:
Scott Wilson
2024-11-28 13:13:23 -08:00
parent 8b3af92d23
commit bcc2840020
5 changed files with 32 additions and 38 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { ProjectMembershipRole, TOrgRole } from "@app/hooks/api/roles/types";
enum OrgMembershipRole {
Admin = "admin",
@@ -23,3 +23,6 @@ export const formatProjectRoleName = (name: string) => {
export const isCustomProjectRole = (slug: string) =>
!Object.values(ProjectMembershipRole).includes(slug as ProjectMembershipRole);
export const findOrgMembershipRole = (roles: TOrgRole[], role: string) =>
isCustomOrgRole(role) ? roles.find((r) => r.id === role) : roles.find((r) => r.slug === role);