import React from 'react'; import type { Encounter } from 'fhir/r4'; import { Section } from '../FieldHistory/FieldLayout'; import { resolvedVisitNote, useCurrentVisitNote, type VisitNoteSource, type VisitNoteState } from './useEncounterVisitNote'; const VisitNoteSection: React.FC<{ state: VisitNoteState }> = ({ state }) => (
{state.status === 'loading' && (

Loading the visit note...

)} {state.status === 'failed' && (

The visit note could not be loaded. Close and open the encounter to try again.

)} {state.status === 'ready' && state.texts.map((text, index) => (

{text}

))} {state.status === 'ready' && state.incomplete && (

Not every note for this patient could be read, so this visit may have a note that is not shown here.

)} {state.status === 'ready' && !state.incomplete && state.texts.length === 0 && (

No visit note recorded

)}
); const CurrentVisitNote: React.FC<{ encounter: Encounter }> = ({ encounter }) => ( ); // Mounted only while Encounter Details is open, so a closed dialog reads nothing. export const EncounterVisitNote: React.FC<{ encounter: Encounter; source: VisitNoteSource }> = ({ encounter, source }) => source.kind === 'current' ? : ;