feat: update doctor display logic to prioritize display_name and enhance metadata description with address details

This commit is contained in:
hamed
2026-07-19 19:57:05 +03:30
parent 1522ee8b73
commit 18484f974d
2 changed files with 8 additions and 4 deletions
+3 -3
View File
@@ -39,7 +39,7 @@ function ItemDoctor({ doctor, loading, setDoctors, priority = false }) {
<TextLoading loading={loading} width={90} height={15}>
<Link href={`/doctor/${doctor?.uuid}`}>
<p className="text-[#3B3B3B] text-[14px] font-bold">
{doctor?.name}
{doctor?.display_name || doctor?.name}
</p>
</Link>
</TextLoading>
@@ -92,13 +92,13 @@ function ItemDoctor({ doctor, loading, setDoctors, priority = false }) {
{/* Arrow */}
<Link
href={`/doctor/${doctor?.uuid}`}
aria-label={`مشاهده پروفایل ${doctor?.name || "پزشک"}`}
aria-label={`مشاهده پروفایل ${doctor?.display_name || doctor?.name || "پزشک"}`}
>
<Button
variant="contained"
onClick={handleLoading}
disabled={doctor?.loading}
aria-label={`مشاهده پروفایل ${doctor?.name || "پزشک"}`}
aria-label={`مشاهده پروفایل ${doctor?.display_name || doctor?.name || "پزشک"}`}
className="!p-[14px] !absolute !left-4 !bottom-4 !rounded-full !w-fit"
>
<div className={doctor && doctor.loading ? "opacity-0" : ""}>
+5 -1
View File
@@ -76,9 +76,13 @@ export async function generateMetadata({ params }) {
.replace(/<[^>]*>/g, "")
.replace(/\s+/g, " ")
.trim();
// doctor.address آرایه‌ای از آبجکت آدرس است؛ متن آدرس یا نام شهر را می‌گیریم
// (الحاق مستقیم آرایه «[object Object]» می‌ساخت).
const firstAddress = Array.isArray(doctor.address) ? doctor.address[0] : null;
const addressText = firstAddress?.address || firstAddress?.city?.name || "";
const description = (
detailText ||
`رزرو نوبت آنلاین ${doctorTitle(doctor.name)}${specialtyNames ? " متخصص " + specialtyNames : ""}${doctor.address ? " | " + doctor.address : ""}`.trim()
`رزرو نوبت آنلاین ${doctorTitle(doctor.name)}${specialtyNames ? " متخصص " + specialtyNames : ""}${addressText ? " | " + addressText : ""}`.trim()
).slice(0, 160);
const image = imageUrl(doctor.img?.[0]?.url) || FALLBACK_IMG;
// C1-b — پزشک به دامنهٔ شهر خودش canonical می‌شود، روی هر دامنه‌ای که سرو شود.