"use client"; import { useEffect, useState } from "react"; import DoctorAvatar from "@/app/component/DoctorAvatar"; import QrImg from "./QrImg"; import SiteLogo from "./SiteLogo"; import { getStateInfoClient } from "@/lib/getStateInfoClient"; import StarDI from "@/components/icons/StarDI"; const ACCENT = "#16528C"; const ACCENT_LIGHT = "#2E77C4"; const ORANGE = "#F17732"; function PosterLight({ data, onQrReady }) { const [city, setCity] = useState(null); useEffect(() => { const { matchedCity } = getStateInfoClient(); setCity(matchedCity || null); }, []); const specialties = (data?.specialties ?? []).filter((s) => s?.name).slice(0, 4); const services = (data?.expertise ?? []).filter((s) => s?.name); const shownServices = services.slice(0, 8); const moreServices = services.length - shownServices.length; const rawAddress = data?.address?.[0]?.address; const address = rawAddress && rawAddress.length > 120 ? `${rawAddress.slice(0, 120).trimEnd()}…` : rawAddress; const phones = (data?.address ?? []) .map((a) => a?.phone) .filter(Boolean) .slice(0, 2); const badges = [ Number(data?.experience) > 0 && { label: `${data.experience} سال تجربه` }, (data?.point ?? 0) > 0 && { icon: , label: `امتیاز ${data.point}` }, (data?.satisfaction ?? 0) > 0 && { label: `${data.satisfaction}% رضایت بیماران` }, ].filter(Boolean); return (
{/* top brand band */}
{city?.site_name || "نوبت ۷۲۴"} {city?.domain || "nobat724.com"}
{/* avatar overlapping band */}

{data?.name}

{specialties.map((s, i) => ( {s.name} ))}
{badges.length > 0 && (
{badges.map((b, i) => ( {i > 0 && ·} {b.icon} {b.label} ))}
)} {data?.medical_system_code && (

کد نظام پزشکی:{" "} {data.medical_system_code}

)} {/* services */} {shownServices.length > 0 && (

خدمات

{shownServices.map((s, i) => ( {s.name} ))} {moreServices > 0 && ( + {moreServices} خدمت دیگر )}
)} {/* address / phone */} {(address || phones.length > 0) && (
{address && (

آدرس: {address}

)} {phones.length > 0 && (

تلفن: {phones.map((p, i) => ( {p} {i < phones.length - 1 ? " | " : ""} ))}

)}
)}
{/* footer */}
رزرو نوبت آنلاین — اسکن کنید {city?.domain || "nobat724.com"}
نوبت‌دهی ۲۴ ساعته
); } export default PosterLight;