import React from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
import { ArrowRightIcon } from '@heroicons/react/24/outline';
import { api } from '../lib/api';
import type { ApiResponse } from '../lib/api';
import type { Doctor } from '../types';
import { formatDate } from '../lib/utils';
import PageHeader from '../components/ui/PageHeader';
import { ActiveBadge } from '../components/ui/StatusBadge';
function InfoRow({ label, value }: { label: string; value: React.ReactNode }) {
return (
{label}
{value ?? '—'}
);
}
export default function DoctorDetailPage() {
const { uuid } = useParams<{ uuid: string }>();
const navigate = useNavigate();
const { data, isLoading } = useQuery({
queryKey: ['doctor', uuid],
queryFn: () => api.get>(`/api/v1/doctor/${uuid}`),
enabled: !!uuid,
});
const doctor = data?.data;
return (
navigate('/admin/doctors')}
className="flex items-center gap-2 text-sm text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-100 transition-colors"
>
بازگشت
}
/>
{isLoading ? (
{Array.from({ length: 6 }).map((_, i) => (
))}
) : doctor ? (
{doctor.profile_image ? (

) : (
{doctor.first_name?.[0] ?? '?'}
)}
دکتر {doctor.first_name} {doctor.last_name}
{doctor.degree}
{doctor.medical_code}} />
} />
تخصصها
{doctor.specialties?.length ? (
doctor.specialties.map((s) => (
{s.name}
))
) : (
تخصصی ثبت نشده
)}
{doctor.bio && (
)}
) : (
پزشکی یافت نشد
)}
);
}