From e8a7bdf2fc9a77df068ba630861678a084350f89 Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Sun, 19 Jul 2026 16:17:24 +0330 Subject: [PATCH] feat: enhance doctor and clinic components with doctorTitle helper and improve rendering logic --- .../clinic/components/about/images/Images.js | 4 +++ .../clinic/components/contact/Detail.js | 30 +++++++++++++++---- components/clinic/components/contact/index.js | 24 +++++++++------ components/doctor/detailDoctor/List.js | 4 ++- components/doctor/detailDoctor/Title.js | 3 +- components/doctor/index.js | 3 +- components/doctor/poster/PosterLight.js | 3 +- components/doctor/poster/index.js | 3 +- 8 files changed, 54 insertions(+), 20 deletions(-) diff --git a/components/clinic/components/about/images/Images.js b/components/clinic/components/about/images/Images.js index 137143c..d84b07e 100644 --- a/components/clinic/components/about/images/Images.js +++ b/components/clinic/components/about/images/Images.js @@ -7,6 +7,10 @@ import { imageUrl } from "@/helper"; function Images({ data }) { const images_clinic = data?.images_clinic || []; + // کلینیک بدون عکس، بلوک تصویر ندارد — تصویر پیش‌فرض به‌جای «عکسی ثبت نشده» + // خوانده می‌شود و کاربر آن را عکس واقعی کلینیک فرض می‌کند. + if (images_clinic.length === 0) return null; + return (
- - - + {workingDays && ( + + )} + {phone && ( + + {phone} + + } + /> + )} + {address && } ); } diff --git a/components/clinic/components/contact/index.js b/components/clinic/components/contact/index.js index 3ff1ecc..ed76b1a 100644 --- a/components/clinic/components/contact/index.js +++ b/components/clinic/components/contact/index.js @@ -12,13 +12,22 @@ function Contact({ data }) { const handleOpen = () => setOpen(true); const handleClose = () => setOpen(false); + // بدون مختصات و بدون نشانی، کوئری نقشه خالی می‌ماند و iframe نقطهٔ بی‌ربط + // نشان می‌دهد؛ در آن حالت نقشه و دکمهٔ مسیریابی اصلاً معنا ندارند. + const hasCoords = Boolean(data?.map?.latitude && data?.map?.longitude); + const mapQuery = hasCoords + ? `${data.map.latitude},${data.map.longitude}` + : data?.location?.trim() + ? encodeURIComponent(data.location.trim()) + : ""; + return (
- مسیریابی - + }
-
+ {mapQuery &&
@@ -60,7 +66,7 @@ function Contact({ data }) { -
+
}
); } diff --git a/components/doctor/detailDoctor/List.js b/components/doctor/detailDoctor/List.js index 350a931..bc3251f 100644 --- a/components/doctor/detailDoctor/List.js +++ b/components/doctor/detailDoctor/List.js @@ -1,3 +1,5 @@ +import { doctorTitle } from "@/helper"; + // Icons import CopyBlueD from "@/components/icons/CopyBlueD"; import DownloadBlue from "@/components/icons/DownloadBlue"; @@ -121,7 +123,7 @@ function List({ hiddenRef, data, qrReady }) { typeof window !== "undefined" ? window.location.href : ""; const getShareText = () => - data?.name ? `معرفی ${data.name} در نوبت 724` : "معرفی پزشک در نوبت 724"; + data?.name ? `معرفی ${doctorTitle(data.name)} در نوبت 724` : "معرفی پزشک در نوبت 724"; const openShareWindow = (url) => { if (typeof window !== "undefined") { diff --git a/components/doctor/detailDoctor/Title.js b/components/doctor/detailDoctor/Title.js index 973d1bf..b5e8841 100644 --- a/components/doctor/detailDoctor/Title.js +++ b/components/doctor/detailDoctor/Title.js @@ -1,3 +1,4 @@ +import { doctorTitle } from "@/helper"; import CircularLoading from "@/app/component/loading/Circular"; import CustomLoading from "@/app/component/loading/Custom"; import TextLoading from "@/app/component/loading/Text"; @@ -35,7 +36,7 @@ function Title({ doctor }) {

- {doctor?.name} + {doctorTitle(doctor?.name)}

{isUnclaimed && ( diff --git a/components/doctor/index.js b/components/doctor/index.js index 4eb0965..7f13cf1 100644 --- a/components/doctor/index.js +++ b/components/doctor/index.js @@ -6,6 +6,7 @@ import Share from "./detailDoctor/Share"; import CustomLoading from "@/app/component/loading/Custom"; import Faq from "@/components/specialties/detail/Faq"; import specialtiesData from "@/data/specialties.json"; +import { doctorTitle } from "@/helper"; // مقصد تمیز صفحهٔ فرود تخصص؛ اگر تخصص slug نداشت، لیست پزشکان با کوئری قدیمی. const specialtyHref = (name) => { @@ -31,7 +32,7 @@ function DoctorPage({ doctor, comments, rateAggregate, addresses, bookableAddres ))} -

{doctor?.name}

+

{doctorTitle(doctor?.name)}

diff --git a/components/doctor/poster/PosterLight.js b/components/doctor/poster/PosterLight.js index fa672df..c59075d 100644 --- a/components/doctor/poster/PosterLight.js +++ b/components/doctor/poster/PosterLight.js @@ -4,6 +4,7 @@ import DoctorAvatar from "@/app/component/DoctorAvatar"; import QrImg from "./QrImg"; import SiteLogo from "./SiteLogo"; import { getStateInfoClient } from "@/lib/getStateInfoClient"; +import { doctorTitle } from "@/helper"; import StarDI from "@/components/icons/StarDI"; @@ -83,7 +84,7 @@ function PosterLight({ data, onQrReady }) {

- {data?.name} + {doctorTitle(data?.name)}

diff --git a/components/doctor/poster/index.js b/components/doctor/poster/index.js index 67974c7..1eb5a47 100644 --- a/components/doctor/poster/index.js +++ b/components/doctor/poster/index.js @@ -4,6 +4,7 @@ import DoctorAvatar from "@/app/component/DoctorAvatar"; import QrImg from "./QrImg"; import SiteLogoBase from "./SiteLogo"; import { getStateInfoClient } from "@/lib/getStateInfoClient"; +import { doctorTitle } from "@/helper"; import StarDI from "@/components/icons/StarDI"; import ClipBoard from "@/components/icons/ClipBoard"; @@ -124,7 +125,7 @@ function Poster({ data, onQrReady }) {

- {data?.name} + {doctorTitle(data?.name)}

{specialties.map((s, i) => (