import { StateTag } from '@ballerine/common'; import { Badge } from '@ballerine/ui'; import { FunctionComponent, useMemo } from 'react'; import { AssignDropdown } from '@/common/components/atoms/AssignDropdown/AssignDropdown'; import { Avatar } from '@/common/components/atoms/Avatar'; import { createInitials } from '@/common/utils/create-initials/create-initials'; import { ctw } from '@/common/utils/ctw/ctw'; import { stringToRGB } from '@/common/utils/string-to-rgb/string-to-rgb'; import { NotesButton } from '@/domains/notes/NotesButton'; import { NotesSheet } from '@/domains/notes/NotesSheet'; import { ActionsVariant } from '@/pages/Entity/components/Case/actions-variants/ActionsVariant/ActionsVariant'; import { CaseOptions } from '@/pages/Entity/components/Case/components/CaseOptions/CaseOptions'; import { tagToBadgeData } from './consts'; import { useCaseActionsLogic } from './hooks/useCaseActionsLogic/useCaseActionsLogic'; import { IActionsProps } from './interfaces'; /** * @description To be used by {@link Case}. Displays the entity's full name, avatar, and handles the reject/approve mutation. * * @param props * @param props.id - The id of the entity, passed into the reject/approve mutation. * @param props.entityId - The id of the selected entity to be used in the notes. * @param props.fullName - The full name of the entity. * @param props.showResolutionButtons - Whether to show the reject/approve buttons. * * @see {@link Case} * * @constructor */ export const Actions: FunctionComponent = ({ id, entityId, fullName, showResolutionButtons, }) => { const { tag, assignedUser, authenticatedUser, isLoadingCase, assignees, onMutateAssignWorkflow, workflowDefinition, isWorkflowCompleted, avatarUrl, notes, isNotesOpen, setIsNotesOpen, workflow, } = useCaseActionsLogic({ workflowId: id, fullName }); const entityInitials = createInitials(fullName); const rgb = useMemo(() => stringToRGB(fullName), [fullName]); return (
{ onMutateAssignWorkflow(id, id === authenticatedUser?.id); }} authenticatedUserId={authenticatedUser?.id} isDisabled={isWorkflowCompleted} excludedRoles={['viewer']} />

{fullName} {workflow?.config?.example === true && ( Sample Data )}

{tag && (
Status {tagToBadgeData[tag].text}
)}
{showResolutionButtons && workflowDefinition && ( )}
); };