"use client";
import { footerL, footerR } from "@/constans";
import Logo from "@/app/component/Logo";
import Link from "next/link";
// Icons
import Linkedin from "../../icons/Linkedin";
import Telegram from "../../icons/Telegram";
import Whatsapp from "../../icons/Whatsapp";
import Instagram from "../../icons/Instagram";
import LocationF from "../../icons/LocationF";
import CalendarAddF from "../../icons/CalendarAddF";
import StethoscopeF from "../../icons/StethoscopeF";
import LogoNamad from "./LogoNamad";
import HeadMenu from "./menu/HeadMenu";
import ListMenu from "./menu/ListMenu";
import { useState } from "react";
const head = [
{ icon: , text: "جستجوی پزشک در شهر شما" },
{ icon: , text: "نوبت گیری سریع و آسان" },
{
icon: ,
text: "دشبورد اختصاصی برای پزشکان",
link: "https://clinic-pro.ir/",
},
];
function buildSocialUrl(name, value) {
if (!value) return null;
if (/^https?:\/\//i.test(value)) return value;
const handle = value.replace(/^@/, "").replace(/^\+/, "");
switch (name) {
case "instagram":
return `https://instagram.com/${handle}`;
case "telegram":
return `https://t.me/${handle}`;
case "whatsapp":
// wa.me needs international format: 09xx… → 989xx…
return `https://wa.me/${handle.replace(/\D/g, "").replace(/^0/, "98")}`;
default:
return value;
}
}
function Footer({ matchedCity }) {
const socialMedias = [
{
icon: ,
name: "instagram",
},
{
icon: ,
name: "telegram",
},
{
icon: ,
name: "whatsapp",
},
];
const [openMenu, setOpenMenu] = useState({
right: false,
left: false,
});
const changeMenu = (name) =>
setOpenMenu({ ...openMenu, [name]: !openMenu[name] });
return (
{head.map((item, idx) => (
!item.link && e.preventDefault}
>
))}
{/* Right */}
{/* Icon */}
{matchedCity?.footer_description}
{/* Center */}
{/* Left */}
همراه با ما باشید:
{socialMedias.map((item, idx) => {
const url = buildSocialUrl(item.name, matchedCity?.social_media?.[item.name]);
return (
-
{url ? (
{item.icon}
) : (
{item.icon}
)}
);
})}
{matchedCity?.footerDisclaimer}
);
}
export default Footer;