Skip to main content
Glama
CommunicationDetails.tsx1.75 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { Paper, Tabs, Title } from '@mantine/core'; import type { Communication } from '@medplum/fhirtypes'; import { CodeableConceptDisplay, ResourceHistoryTable, ResourceTable } from '@medplum/react'; import type { JSX } from 'react'; import { useNavigate } from 'react-router'; interface CommunicationDetailsProps { readonly communication: Communication; } export function CommunicationDetails({ communication }: CommunicationDetailsProps): JSX.Element { const navigate = useNavigate(); const id = communication.id as string; const tabs = ['Details', 'History']; // Get the current tab const tab = window.location.pathname.split('/').pop(); const currentTab = tab && tabs.map((t) => t.toLowerCase()).includes(tab) ? tab : tabs[0].toLowerCase(); function handleTabChange(newTab: string | null): void { navigate(`/Communication/${id}/${newTab ?? ''}`)?.catch(console.error); } return ( <Paper m="md" p="md"> <Title> <CodeableConceptDisplay value={communication.topic} /> </Title> <Tabs defaultValue="details" value={currentTab.toLowerCase()} onChange={handleTabChange}> <Tabs.List> {tabs.map((tab) => ( <Tabs.Tab key={tab} value={tab.toLowerCase()}> {tab} </Tabs.Tab> ))} </Tabs.List> <Tabs.Panel value="details"> <ResourceTable value={communication} ignoreMissingValues={true} /> </Tabs.Panel> <Tabs.Panel value="history"> <ResourceHistoryTable resourceType="Communication" id={communication.id} /> </Tabs.Panel> </Tabs> </Paper> ); }

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