feat(footer): name the visitor's city in the search chip and link the chips

The first chip said "your city" on every domain even though each domain is
already scoped to one; it now carries that city's name, falling back to the
old wording on the root domain, which has no city. Both site chips link to
"/" — relative, so each domain lands on its own home page rather than
throwing the visitor onto another one — and the third is retitled to name
the product it points at.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-08-18 15:10:18 +03:30
co-authored by Claude Opus 5
parent 5e86f115d3
commit 45f94743fd
+23 -15
View File
@@ -16,16 +16,28 @@ import LogoNamad from "./LogoNamad";
import HeadMenu from "./menu/HeadMenu";
import ListMenu from "./menu/ListMenu";
import { useState } from "react";
import { isRootCity } from "@/lib/rootCity";
const head = [
{ icon: <LocationF />, text: "جستجوی پزشک در شهر شما" },
{ icon: <CalendarAddF />, text: "نوبت گیری سریع و آسان" },
{
icon: <StethoscopeF />,
text: "دشبورد اختصاصی برای پزشکان",
link: "https://clinic-pro.ir/",
},
];
// روی دامنهٔ ریشه (nobat724.com) شهری در کار نیست، پس همان «شهر شما» می‌ماند؛
// روی دامنهٔ هر شهر، نام همان شهر می‌نشیند. لینک نسبی است تا هر دامنه به ریشهٔ
// خودش برود و کاربر بین دامنه‌ها پرت نشود.
const buildHead = (matchedCity) => {
const cityName = isRootCity(matchedCity) ? null : matchedCity?.name;
return [
{
icon: <LocationF />,
text: cityName ? `جستجوی پزشک در شهر ${cityName}` : "جستجوی پزشک در شهر شما",
link: "/",
},
{ icon: <CalendarAddF />, text: "نوبت گیری سریع و آسان", link: "/" },
{
icon: <StethoscopeF />,
text: "مدیریت کلینیک با کلینیک پرو",
link: "https://clinic-pro.ir/",
},
];
};
function buildSocialUrl(name, value) {
if (!value) return null;
@@ -70,12 +82,8 @@ function Footer({ matchedCity }) {
return (
<div className="pb-[11px]">
<div className="flex items-center justify-evenly gap-[12px]">
{head.map((item, idx) => (
<Link
key={idx}
href={item.link || ""}
onClick={(e) => !item.link && e.preventDefault}
>
{buildHead(matchedCity).map((item, idx) => (
<Link key={idx} href={item.link}>
<div
className="flex flex-col lg:flex-row items-center cursor-pointer justify-start gap-1 p-[6px] hover:transition-all transition-all duration-300 hover:duration-300 rounded-[8px] border-solid border border-[#EFEFEF] bg-[#F7F7F7] hover:bg-none hover:border-[#FDBD9F]"
>