feat: enhance clinic contact information display with new helper functions for phone, city, and state
This commit is contained in:
@@ -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",
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user