Skip to main content
Glama
CommunicationActions.tsx1.81 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { Stack, Title } from '@mantine/core'; import { parseReference } from '@medplum/core'; import type { Communication } from '@medplum/fhirtypes'; import type { JSX } from 'react'; import { AddParticipant } from './AddParticipant'; import { AddSubject } from './AddSubject'; import { CloseOpenThread } from './CloseOpenThread'; import { CreateEncounter } from './CreateEncounter'; import { EditThreadTopic } from './EditThreadTopic'; interface CommunicationActionsProps { readonly communication: Communication; readonly onChange: (communication: Communication) => void; } export function CommunicationActions(props: CommunicationActionsProps): JSX.Element { return ( <Stack m="md" p="md"> <Title>Thread Actions</Title> <EditThreadTopic communication={props.communication} onChange={props.onChange} /> <AddParticipant communication={props.communication} onChange={props.onChange} /> {!props.communication.subject ? ( <AddSubject communication={props.communication} onChange={props.onChange} /> ) : null} <CloseOpenThread communication={props.communication} onChange={props.onChange} /> {props.communication.status === 'completed' && checkThreadForPatient(props.communication) ? ( <CreateEncounter communication={props.communication} onChange={props.onChange} /> ) : null} </Stack> ); } function checkThreadForPatient(thread: Communication): boolean { const recipients = thread.recipient; if (!recipients || recipients.length === 0) { return false; } for (const recipient of recipients) { if (parseReference(recipient)[0] === 'Patient') { return true; } } return false; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server