// ========================================================== // itooth — shared UI pieces (logo, icons, product illustrations) // ========================================================== const ToothLogo = ({ size = 28, color = "currentColor" }) => ( ); const Icon = { Search: () => ( ), User: () => ( ), Bag: () => ( ), Arrow: ({ flip }) => ( ), ArrowLeft: () => ( ), ArrowRight: () => ( ), Close: () => ( ), Plus: () => ( ), Minus: () => ( ), Check: () => ( ), Leaf: () => ( ), Shield: () => ( ), Sparkle: () => ( ), Clock: () => ( ), SoundOn: () => ( ), SoundOff: () => ( ), Whatsapp: () => ( ), }; // Product illustration — used when product has no real photo const ProductIllustration = ({ product, className = "" }) => { const key = product?.illus_key || product?.slug || ""; const bgMap = { "brush-soft": { bg: "#E9F6EE", accent: "#1B7A4B" }, "paste-mint": { bg: "#EEF7F1", accent: "#2D8F5F" }, "whitening-strips": { bg: "#F0F8F3", accent: "#0F5132" }, "whitening-kit": { bg: "#111111", accent: "#34C27A", dark: true }, "tongue-scraper": { bg: "#F2F6F2", accent: "#444" }, "interdental": { bg: "#E9F6EE", accent: "#1B7A4B" }, "eraser": { bg: "#F7FAF5", accent: "#1B7A4B" }, "brush-case": { bg: "#EEF7F1", accent: "#2D8F5F" }, }; const theme = bgMap[key] || { bg: "#F2F6F2", accent: "#1B7A4B" }; return (
{renderIllus(key, theme)}
); }; function renderIllus(id, { accent, dark }) { const stroke = dark ? "#fff" : "#111"; switch (id) { case "brush-soft": return ( {Array.from({ length: 22 }).map((_, i) => ( ))} ); case "paste-mint": return ( itooth WHITE MINT ); case "whitening-strips": return ( WHITENING ); case "whitening-kit": return ( PRO ); case "tongue-scraper": return ( ); case "interdental": return ( {Array.from({ length: 18 }).map((_, i) => ( ))} ); case "eraser": return ( ); case "brush-case": return ( ); default: return ( ); } } // Helper: get localized field value const tr = (row, field, lang) => row?.[`${field}_${lang}`] ?? row?.[`${field}_en`] ?? ""; // Helper: prepend base path to an asset URL const asset = (u) => { if (!u) return u; if (/^https?:\/\//.test(u) || u.startsWith('data:')) return u; const base = window.ITOOTH_BASE || ''; return base + (u.startsWith('/') ? u : '/' + u); }; // Money formatter const fmt = (n, lang) => { try { return Number(n || 0).toLocaleString(lang === "ar" ? "ar-IQ" : "en-US"); } catch { return String(n || 0); } }; Object.assign(window, { ToothLogo, Icon, ProductIllustration, fmt, tr, asset, });