feat: enhance clinic contact information display with new helper functions for phone, city, and state

This commit is contained in:
hamed
2026-07-19 16:44:06 +03:30
parent 10b5a19576
commit 1522ee8b73
6 changed files with 366 additions and 25 deletions
+15 -3
View File
@@ -9,6 +9,12 @@ import { extractEntityCityId } from "@/lib/domainHelpers";
import { isThinClinic } from "@/lib/entityQuality";
import { safeJsonLd } from "@/lib/sanitize";
import { imageUrl } from "@/helper";
import {
getClinicPhone,
toE164Ir,
getClinicCity,
getClinicState,
} from "@/lib/clinicContact";
const API_URL = process.env.NEXT_PUBLIC_API_URL;
@@ -114,6 +120,10 @@ async function Clinic({ params, searchParams }) {
? Object.values(clinic.social_media).filter(Boolean)
: [];
const clinicPhone = getClinicPhone(clinic);
const clinicCity = getClinicCity(clinic);
const clinicState = getClinicState(clinic);
const jsonLd = clinic
? {
"@context": "https://schema.org",
@@ -127,11 +137,13 @@ async function Clinic({ params, searchParams }) {
name: clinic.title,
},
}),
...(clinic.phone && { telephone: clinic.phone }),
...(clinic.location && {
...(clinicPhone && { telephone: toE164Ir(clinicPhone) }),
...((clinic.location || clinicCity) && {
address: {
"@type": "PostalAddress",
streetAddress: clinic.location,
...(clinic.location && { streetAddress: clinic.location.trim() }),
...(clinicCity && { addressLocality: clinicCity }),
...(clinicState && { addressRegion: clinicState }),
addressCountry: "IR",
},
}),