'use client'; import { Search } from 'lucide-react'; import { useTranslations } from 'next-intl'; import { Button } from '@/components/ui/shared/Button'; import { Input } from '@/components/ui/shared/Input'; import { formatMobileForDisplay } from '@/lib/phone'; import type { Patient } from '@/types/patient'; interface AppointmentsPatientSearchProps { search: string; onSearchChange: (value: string) => void; patients: Patient[]; selectedPatientId?: string; onSelectPatient: (patient: Patient) => void; loading?: boolean; canAddPatient: boolean; onAddPatient: () => void; } export function AppointmentsPatientSearch({ search, onSearchChange, patients, selectedPatientId, onSelectPatient, loading = false, canAddPatient, onAddPatient, }: AppointmentsPatientSearchProps) { const t = useTranslations('appointments'); const tPatients = useTranslations('patients'); const trimmed = search.trim(); const showAddForEmptyResults = trimmed.length > 0 && !loading && patients.length === 0; return (
onSearchChange(e.target.value)} icon={} />
{showAddForEmptyResults && ( )}
{loading &&

{t('searching')}

} {!loading && trimmed.length === 0 && (

{t('searchHint')}

)} {patients.map((patient) => { const isSelected = selectedPatientId === patient.id; return ( ); })}
); }