import { Link } from 'react-router-dom' import type { MouseEvent } from 'react' import { PRIMARY_NAV } from '@/data/nav' import { getCMSConfig, useCMS, useCMSTexts } from '@/services/cms' export default function Footer() { const { data: config } = useCMS(getCMSConfig, null) const { data: texts } = useCMSTexts() const hotline = String(config?.hotline || '').trim() const phoneLink = hotline.replace(/[^\d+]/g, '') const companyName = texts['footer.company'] || '成都阿美巴企业管理咨询有限公司' const address = String(config?.contact_address || '四川省成都市双流区正兴街道湖畔路北段366号1栋3楼1号').trim() // Desktop falls back to AMap's web search. On phones use the operating system's // map-navigation scheme so the user's installed/default map app handles the route. const amapLink = `https://uri.amap.com/search?keyword=${encodeURIComponent(address)}&city=${encodeURIComponent('成都')}&view=map&src=ameiba` const openNavigation = (event: MouseEvent) => { const ua = window.navigator.userAgent const destination = encodeURIComponent(address) if (/Android/i.test(ua)) { event.preventDefault() window.location.href = `geo:0,0?q=${destination}` } else if (/iPhone|iPad|iPod/i.test(ua)) { event.preventDefault() window.location.href = `maps://?q=${destination}` } } return ( ) }