import { faCheck, faCopy, faPencil } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ProjectPermissionCan } from "@app/components/permissions"; import { IconButton, Tooltip } from "@app/components/v2"; import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context"; import { useTimedReset } from "@app/hooks"; import { useGetProjectRoleBySlug } from "@app/hooks/api"; import { ProjectMembershipRole } from "@app/hooks/api/roles/types"; import { UsePopUpState } from "@app/hooks/usePopUp"; type Props = { roleSlug: string; handlePopUpOpen: (popUpName: keyof UsePopUpState<["role"]>, data?: object) => void; }; export const RoleDetailsSection = ({ roleSlug, handlePopUpOpen }: Props) => { const [copyTextId, isCopyingId, setCopyTextId] = useTimedReset({ initialState: "Copy ID to clipboard" }); const { currentWorkspace } = useWorkspace(); const { data } = useGetProjectRoleBySlug(currentWorkspace?.id ?? "", roleSlug as string); const isCustomRole = !Object.values(ProjectMembershipRole).includes( (data?.slug ?? "") as ProjectMembershipRole ); return data ? (

Project Role Details

{isCustomRole && ( {(isAllowed) => { return ( { handlePopUpOpen("role", { roleSlug }); }} > ); }} )}

Role ID

{data.id}

{ navigator.clipboard.writeText(data.id); setCopyTextId("Copied"); }} >

Name

{data.name}

Slug

{data.slug}

Description

{data.description?.length ? data.description : "-"}

) : (
); };