From 00e9ab5cf83fa8d19d1ac7ce215ac5b9a77126b4 Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Sat, 20 Jun 2026 13:53:02 +0330 Subject: [PATCH] feat(footer): implement dynamic social media URLs in footer component --- components/layout/footer/index.js | 53 +++++++++++++++++++++++-------- next.config.js | 20 +++++++++++- 2 files changed, 59 insertions(+), 14 deletions(-) diff --git a/components/layout/footer/index.js b/components/layout/footer/index.js index aef4e1e..4d72682 100644 --- a/components/layout/footer/index.js +++ b/components/layout/footer/index.js @@ -27,6 +27,22 @@ const head = [ }, ]; +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": + return `https://wa.me/${handle.replace(/\D/g, "")}`; + default: + return value; + } +} + function Footer({ matchedCity }) { const socialMedias = [ { @@ -114,20 +130,31 @@ function Footer({ matchedCity }) { همراه با ما باشید: