'use client'; import { FunctionComponent } from 'react'; import Box from '@mui/material/Box'; import Skeleton from '@mui/material/Skeleton'; import Stack from '@mui/material/Stack'; import { AppIconButton, SurfaceCard } from '@/components/common'; import PatientHeader from '@/components/PatientHeader'; import type { Patient } from '@/services/patients/types'; export interface PatientCardProps { patient: Patient; /** Translated relation label; omitted when the patient has no relation set. */ relationLabel?: string; /** Translated gender label. */ genderLabel: string; /** Translated age label (e.g. "70 yrs"); omitted when the birth date is unknown. */ ageLabel?: string; /** Translated condition labels; empty renders the "no conditions" line. */ conditionLabels: string[]; noConditionsLabel: string; onEdit: () => void; onArchive: () => void; editLabel: string; archiveLabel: string; /** When provided, tapping the identity area opens the patient's record (E2). The action buttons are unaffected. */ onOpen?: () => void; /** Accessible label for the tappable identity area (required when `onOpen` is set). */ openLabel?: string; } /** * Patient summary card for the E1 list — the shared `PatientHeader` (relation + name, age/gender, condition * chips) plus edit and archive actions. When `onOpen` is passed the identity area becomes a button that opens * the E2 record viewer; the edit/archive icon buttons keep their own handlers. All display text is translated * by the caller. * @component PatientCard */ const PatientCard: FunctionComponent = ({ patient, relationLabel, genderLabel, ageLabel, conditionLabels, noConditionsLabel, onEdit, onArchive, editLabel, archiveLabel, onOpen, openLabel, }) => { const header = ( ); return ( {onOpen ? ( {header} ) : ( {header} )} ); }; /** Matches the real card's anatomy (identity block + two icon-button actions) for the E1 patient list. */ const PatientCardSkeleton: FunctionComponent = () => ( ); export default Object.assign(PatientCard, { Skeleton: PatientCardSkeleton });