From 315259f44ee28afe42797e78f6cc315bce742681 Mon Sep 17 00:00:00 2001 From: A Charlwood Date: Wed, 11 Feb 2026 02:11:55 +0000 Subject: [PATCH] Task 11: Build DocumentsView for education/certifications --- src/components/PMRInterface.tsx | 3 + src/components/views/DocumentsView.tsx | 209 +++++++++++++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 src/components/views/DocumentsView.tsx diff --git a/src/components/PMRInterface.tsx b/src/components/PMRInterface.tsx index 8073e05..b85def3 100644 --- a/src/components/PMRInterface.tsx +++ b/src/components/PMRInterface.tsx @@ -7,6 +7,7 @@ import { ConsultationsView } from './views/ConsultationsView' import { MedicationsView } from './views/MedicationsView' import { ProblemsView } from './views/ProblemsView' import { InvestigationsView } from './views/InvestigationsView' +import { DocumentsView } from './views/DocumentsView' interface PMRInterfaceProps { children?: React.ReactNode @@ -49,6 +50,8 @@ export function PMRInterface({ children }: PMRInterfaceProps) { return case 'investigations': return + case 'documents': + return default: return (
diff --git a/src/components/views/DocumentsView.tsx b/src/components/views/DocumentsView.tsx new file mode 100644 index 0000000..bf924f9 --- /dev/null +++ b/src/components/views/DocumentsView.tsx @@ -0,0 +1,209 @@ +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' + +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} +
+ )} +
+
+
+ + + + ) +} + +export function DocumentsView() { + const [expandedId, setExpandedId] = useState(null) + + const handleToggle = (id: string) => { + setExpandedId(expandedId === id ? null : id) + } + + return ( +
+
+

+ Attached Documents +

+

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

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