/* TDD — common components (Logo, Nav, Footer) */ const { useState, useEffect, useRef } = React; function Logo({ size = 36 }) { // Inline SVG of TDD logo (currentColor) return ( THE DESIGN DESTINATION ); } const LOCALES = [ { code: "en", label: "English", short: "EN", dir: "ltr" }, { code: "ar", label: "العربية", short: "AR", dir: "rtl" }, { code: "ru", label: "Русский", short: "RU", dir: "ltr" }, { code: "zh", label: "中文", short: "ZH", dir: "ltr" }, ]; const NAV_LINKS = [ { key: "brands", label: "Brands" }, { key: "materials", label: "Materials" }, { key: "studio", label: "Studio" }, { key: "about", label: "About" }, { key: "contact", label: "Contact" }, ]; // Simple AR copy (preview-level only) const AR_LINKS = { brands: "العلامات", materials: "المواد", studio: "الاستوديو", about: "عن TDD", contact: "تواصل", bookCta: "احجز زيارة الاستوديو", }; function Nav({ route, onNavigate, locale, setLocale, dir }) { const [openLocale, setOpenLocale] = useState(false); const localeRef = useRef(null); useEffect(() => { function onDoc(e) { if (localeRef.current && !localeRef.current.contains(e.target)) setOpenLocale(false); } document.addEventListener("mousedown", onDoc); return () => document.removeEventListener("mousedown", onDoc); }, []); const link = (l) => locale === "ar" ? (AR_LINKS[l.key] || l.label) : l.label; const ctaLabel = locale === "ar" ? AR_LINKS.bookCta : "Book a Studio Visit"; return ( ); } function Footer({ onNavigate }) { const d = window.TDD_DATA; return ( ); } function ScrollProgress() { const [w, setW] = useState(0); useEffect(() => { function onScroll() { const h = document.documentElement; const total = h.scrollHeight - h.clientHeight; setW(total > 0 ? (h.scrollTop / total) * 100 : 0); } onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, []); return
; } // Hook for reveal-on-scroll function useReveal() { useEffect(() => { const els = document.querySelectorAll(".reveal:not(.in)"); const io = new IntersectionObserver((entries) => { entries.forEach(e => { if (e.isIntersecting) e.target.classList.add("in"); }); }, { threshold: 0.12 }); els.forEach(el => io.observe(el)); return () => io.disconnect(); }); } Object.assign(window, { Logo, Nav, Footer, ScrollProgress, useReveal, LOCALES, AR_LINKS });