Skip to main content
Glama
AnnotationInput.tsx1.34 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { TextInput } from '@mantine/core'; import { createReference } from '@medplum/core'; import type { Annotation } from '@medplum/fhirtypes'; import { useMedplumProfile } from '@medplum/react-hooks'; import type { JSX } from 'react'; import { useState } from 'react'; import type { ComplexTypeInputProps } from '../ResourcePropertyInput/ResourcePropertyInput.utils'; export interface AnnotationInputProps extends ComplexTypeInputProps<Annotation> {} export function AnnotationInput(props: AnnotationInputProps): JSX.Element { const author = useMedplumProfile(); const [value, setValue] = useState<Annotation>(props.defaultValue || ({} as Annotation)); function setText(text: string): void { const newValue: Annotation = text ? { text, authorReference: author && createReference(author), time: new Date().toISOString(), } : ({} as Annotation); setValue(newValue); if (props.onChange) { props.onChange(newValue); } } return ( <TextInput disabled={props.disabled} name={props.name} placeholder="Annotation text" defaultValue={value.text} onChange={(e) => setText(e.currentTarget.value)} /> ); }

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