Skip to main content
Glama
ResourceDiffRow.tsx2.32 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { Button, Table } from '@mantine/core'; import type { InternalSchemaElement, TypedValue } from '@medplum/core'; import type { JSX } from 'react'; import { useState } from 'react'; import { ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay'; import classes from './ResourceDiffRow.module.css'; export interface ResourceDiffRowProps { name: string; path: string; property: InternalSchemaElement | undefined; originalValue: TypedValue | undefined; revisedValue: TypedValue | undefined; } export function ResourceDiffRow(props: ResourceDiffRowProps): JSX.Element { const { name, path, property, originalValue, revisedValue } = props; const isAttachmentType = !!property?.type?.find((t) => t.code === 'Attachment'); const [isCollapsed, setIsCollapsed] = useState<boolean>(isAttachmentType); const toggleCollapse = (): void => setIsCollapsed((prev) => !prev); return ( <> {(isAttachmentType && !isCollapsed) || !isAttachmentType ? ( <> <Table.Tr> <Table.Td>{name}</Table.Td> <Table.Td className={classes.removed}> {originalValue && ( <ResourcePropertyDisplay path={path} property={property} propertyType={originalValue.type} value={originalValue.value} ignoreMissingValues={true} /> )} </Table.Td> <Table.Td className={classes.added}> {revisedValue && ( <ResourcePropertyDisplay path={path} property={property} propertyType={revisedValue.type} value={revisedValue.value} ignoreMissingValues={true} /> )} </Table.Td> </Table.Tr> </> ) : ( <Table.Tr> <Table.Td>{name}</Table.Td> <Table.Td colSpan={2} style={{ textAlign: 'right' }}> <Button onClick={toggleCollapse} variant="light"> Expand </Button> </Table.Td> </Table.Tr> )} </> ); }

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