import { Link } from 'react-router-dom'; import starIcon from '../assets/figma/icon-star.svg'; import { experienceLabel, ratingLabel } from '../lib/format.js'; import { doctorPath } from '../lib/links.js'; import { useLeadModal } from '../context/LeadModalContext.jsx'; import './DoctorCard.css'; // Короткая подпись роли: должность («Педиатр»), а если её нет — специальность. export function roleLabel(doctor) { return doctor.position || doctor.specialties?.[0]?.name || ''; } // Запись к врачу: у кого настроен Medflex — ведём туда, у остальных открываем форму заявки. export function BookButton({ doctor, className = '', children = 'Записаться' }) { const { open } = useLeadModal(); if (doctor.booking?.provider === 'medflex' && doctor.booking.url) { return ( {children} ); } return ( ); } function DoctorPhoto({ doctor, className }) { return (
{doctor.photo ? ( {doctor.full_name} ) : ( )}
); } export function RatingBadge({ rating, className = '' }) { if (typeof rating !== 'number') return null; return ( {ratingLabel(rating)} ); } // Плитка для слайдера «Специалисты» на главной. export function DoctorTile({ doctor }) { const path = doctorPath(doctor); return (
{doctor.full_name}

{roleLabel(doctor)}

{doctor.experience_years != null && ( {experienceLabel(doctor.experience_years)} )}
); } // Карточка в списке врачей. export function DoctorRow({ doctor }) { const path = doctorPath(doctor); return (

{roleLabel(doctor)}

{doctor.full_name}
{doctor.experience_years != null && ( {experienceLabel(doctor.experience_years)} )}
{doctor.absent ? ( Временно не принимает ) : ( )} Подробнее
); }