import Link from "next/link" import { fetchSiteInfo } from "@/graphql/queries/getSiteInfo" function normalizePhone(raw: string) { const digits = raw.replace(/[^\d+]/g, "") return digits ? `tel:${digits}` : null } function IconMail(props: React.SVGProps) { return ( ) } function IconPhone(props: React.SVGProps) { return ( ) } function IconClock(props: React.SVGProps) { return ( ) } export default async function TopBar() { const page = await fetchSiteInfo() const get = (k: string) => page?.metadata ?.find((m) => m.key.toLowerCase() === k.toLowerCase()) ?.value?.trim() || "" const email = get("Email") const phone = get("Phone") const timings = get("Timings") // If nothing to show, render nothing if (![email, phone, timings].some(Boolean)) return null const phoneHref = phone ? normalizePhone(phone.split(/\r?\n/).pop() || phone) : null return (
{/* Left: Contact */}
{email && (
{email}
)} {phone && (
{phoneHref ? ( {phone} ) : ( {phone} )}
)}
{/* Right: Timings */} {timings && (
{timings}
)}
) }