import { useState } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { ChevronDown } from 'lucide-react' import { consultations } from '@/data/consultations' import type { Consultation, ViewId } from '@/types/pmr' // ─── Props ────────────────────────────────────────────────────────────────── interface ConsultationsViewProps { onNavigate?: (view: ViewId, itemId?: string) => void initialExpandedId?: string } export function ConsultationsView({ initialExpandedId }: ConsultationsViewProps) { const [expandedId, setExpandedId] = useState(initialExpandedId ?? null) const prefersReducedMotion = typeof window !== 'undefined' ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : false const handleToggle = (id: string) => { setExpandedId(prev => prev === id ? null : id) } return (

Consultation Journal

{consultations.length} entries
{consultations.map(consultation => ( handleToggle(consultation.id)} prefersReducedMotion={prefersReducedMotion} /> ))}
) } // ─── Consultation Entry ───────────────────────────────────────────────────── interface ConsultationEntryProps { consultation: Consultation isExpanded: boolean onToggle: () => void prefersReducedMotion: boolean } function ConsultationEntry({ consultation, isExpanded, onToggle, prefersReducedMotion, }: ConsultationEntryProps) { const keyCodedEntry = consultation.codedEntries[0] return (
{/* Collapsed header — always visible */} {/* Expandable content — height-only animation, NO opacity fade */} {isExpanded && ( )}
) } // ─── Status Dot ───────────────────────────────────────────────────────────── interface StatusDotProps { isCurrent: boolean } function StatusDot({ isCurrent }: StatusDotProps) { return ( ) } // ─── Expanded Content ─────────────────────────────────────────────────────── interface ExpandedContentProps { consultation: Consultation } function ExpandedContent({ consultation }: ExpandedContentProps) { return (
{/* Duration */}
Duration: {consultation.duration}
{/* HISTORY */} HISTORY

{consultation.history}

{/* EXAMINATION */} EXAMINATION
    {consultation.examination.map((item, index) => (
  • - {item}
  • ))}
{/* PLAN */} PLAN
    {consultation.plan.map((item, index) => (
  • - {item}
  • ))}
{/* CODED ENTRIES */} CODED ENTRIES
{consultation.codedEntries.map(entry => ( ))}
) } // ─── Section Header ───────────────────────────────────────────────────────── function SectionHeader({ children }: { children: React.ReactNode }) { return (

{children}

) } // ─── Coded Entry ──────────────────────────────────────────────────────────── interface CodedEntryProps { code: string description: string } function CodedEntry({ code, description }: CodedEntryProps) { return (
[{code}] {description}
) }