import { useState, useEffect, useRef } from 'react' import { ChevronDown, ChevronUp, FileText, Award, GraduationCap, FlaskConical } from 'lucide-react' import { documents } from '@/data/documents' import type { Document, DocumentType } from '@/types/pmr' import { useBreakpoint } from '@/hooks/useBreakpoint' function DocumentTypeIcon({ type }: { type: DocumentType }) { const iconMap: Record = { Certificate: , Registration: , Results: , Research: , } return (
{iconMap[type]}
) } function DocumentRow({ document, isExpanded, onToggle, }: { document: Document isExpanded: boolean onToggle: () => void }) { const contentRef = useRef(null) const [contentHeight, setContentHeight] = useState(undefined) const prefersReducedMotion = useRef( window.matchMedia('(prefers-reduced-motion: reduce)').matches ).current useEffect(() => { if (contentRef.current) { setContentHeight(contentRef.current.scrollHeight) } }, [isExpanded]) return ( <> {document.title} {document.date} {document.source}
Type: {document.type}
Date Awarded: {document.date}
{document.institution && (
Institution: {document.institution}
)} {document.classification && (
Classification: {document.classification}
)} {document.duration && (
Duration: {document.duration}
)} {document.researchDetail && (
Research: {document.researchDetail} {document.researchGrade && ( <>
Grade: {document.researchGrade} )}
)} {document.notes && (
Notes: {document.notes}
)}
) } function MobileDocumentCard({ document, isExpanded, onToggle, }: { document: Document isExpanded: boolean onToggle: () => void }) { return (
{isExpanded && (
Type: {document.type}
Date Awarded: {document.date}
{document.institution && (
Institution: {document.institution}
)} {document.classification && (
Classification: {document.classification}
)} {document.duration && (
Duration: {document.duration}
)} {document.researchDetail && (
Research: {document.researchDetail} {document.researchGrade && ( <>
Grade: {document.researchGrade} )}
)} {document.notes && (
Notes: {document.notes}
)}
)}
) } export function DocumentsView() { const [expandedId, setExpandedId] = useState(null) const { isMobile } = useBreakpoint() const handleToggle = (id: string) => { setExpandedId(expandedId === id ? null : id) } return (

Attached Documents

Education and certifications presented as attached documents in the patient record.

{isMobile ? (
{documents.map((document) => ( handleToggle(document.id)} /> ))}
) : (
{documents.map((document) => ( handleToggle(document.id)} /> ))}
Type Document Date Source Expand
)} {documents.length === 0 && (
No documents attached
)}
) }