// components.jsx — shared icons, primitives, navigation, screen chrome // All components are exported to window for cross-file access. const { useState, useEffect, useRef, useMemo, createContext, useContext } = React; /* ─────────────────────────── ICONS ─────────────────────────── */ // All stroke icons unless noted. 24x24, stroke=currentColor, width=1.7 const I = (path, opts = {}) => (props) => { const { size = 22, fill = "none", stroke = "currentColor", strokeWidth = 1.7, ...rest } = props || {}; return ( {path} ); }; const IconHome = I(<>); const IconHomeFilled = (p) => ; const IconBundles = I(<>); const IconBolt = I(); const IconGrid = I(<>); const IconHeadset = I(<>); const IconUser = I(<>); const IconSearch = I(<>); const IconBell = I(<>); const IconChevronLeft = I(); const IconChevronRight = I(); const IconChevronDown = I(); const IconClose = I(<>); const IconPlus = I(<>); const IconCheck = I(); const IconCheckCircle = (p) => ; const IconWifi = I(<>); const IconPhone = I(); const IconMessage = I(<>); const IconClock = I(<>); const IconGift = I(<>); const IconStar = I(); const IconStarFilled = (p) => ; const IconWhatsapp = (p) => ; const IconShield = I(); const IconCreditCard = I(<>); const IconWallet = I(<>); const IconGlobe = I(<>); const IconChart = I(<>); const IconArrowRight = I(<>); const IconArrowDown = I(<>); const IconRefresh = I(<>); const IconLogout = I(<>); const IconChevronUp = I(); const IconEye = I(<>); const IconLock = I(<>); const IconHelp = I(<>); const IconSparkle = I(<>); const IconPlay = (p) => ; const IconMusic = I(<>); const IconYoutube = (p) => ; const IconTiktok = (p) => ; const IconFacebook = (p) => ; const IconInstagram = (p) => ; const IconMoon = I(); const IconContact = I(<>); const IconHeart = I(); const IconBulb = I(<>); const IconCopy = I(<>); /* ─────────────────────────── PRIMITIVES ─────────────────────────── */ function Logo({ size = "md", onDark = false }) { if (!onDark) { const h = size === "xl" ? 64 : size === "lg" ? 44 : 34; return Telecel — Conectando Energias; } return ( telecel ); } function StatusBar({ time = "9:41", onRed = false }) { return (
{time}
); } function TopBar({ title, onBack, right, transparent }) { return (
{onBack ? ( ) : null}
{title}
{right}
); } function Avatar({ name = "Etiandro Ucha", size, online }) { const initials = name.split(" ").map(s => s[0]).slice(0, 2).join("").toUpperCase(); return (
{initials} {online ? : null}
); } /* ─────────────────────────── BOTTOM NAV ─────────────────────────── */ const NAV_ITEMS = [ { id: "home", label: "Início", icon: IconHome, iconActive: IconHomeFilled }, { id: "bundles", label: "Pacotes", icon: IconBundles }, { id: "recharge", label: "Recarga", icon: IconBolt, accent: true }, { id: "services", label: "Serviços", icon: IconGrid }, { id: "account", label: "Conta", icon: IconUser }, ]; function useIsDesktop(breakpoint = 1024) { const [isDesktop, setIsDesktop] = useState(() => typeof window !== "undefined" ? window.matchMedia(`(min-width: ${breakpoint}px)`).matches : false ); useEffect(() => { const mql = window.matchMedia(`(min-width: ${breakpoint}px)`); const fn = () => setIsDesktop(mql.matches); fn(); if (mql.addEventListener) mql.addEventListener("change", fn); else mql.addListener(fn); window.addEventListener("resize", fn); return () => { if (mql.removeEventListener) mql.removeEventListener("change", fn); else mql.removeListener(fn); window.removeEventListener("resize", fn); }; }, [breakpoint]); return isDesktop; } /* Desktop sidebar */ const SIDENAV_PRIMARY = [ { id: "home", label: "Início", icon: IconHome }, { id: "bundles", label: "Pacotes", icon: IconBundles }, { id: "recharge", label: "Recarga", icon: IconBolt }, { id: "recommended", label: "Recomendado", icon: IconSparkle }, { id: "promotions", label: "Promoções", icon: IconGift }, { id: "services", label: "Serviços", icon: IconGrid }, { id: "electricity", label: "Eletricidade", icon: IconBulb, badge: "Novo" }, ]; const SIDENAV_SECONDARY = [ { id: "loyalty", label: "Recompensas", icon: IconStar }, { id: "transactions", label: "Transações", icon: IconChart }, { id: "payment-methods", label: "Pagamentos", icon: IconWallet }, { id: "notifications", label: "Notificações", icon: IconBell, badge: "2" }, { id: "support", label: "Apoio", icon: IconHeadset }, { id: "account", label: "Conta", icon: IconUser }, ]; function SideNav({ current, onNavigate, user }) { return ( ); } function BottomNav({ current, onNavigate, style = "labels" }) { return (
); } /* ─────────────────────────── CHIPS & CONTROLS ─────────────────────────── */ function Chip({ active, children, onClick, className = "" }) { return ( ); } function Tag({ children, color = "accent" }) { const map = { accent: { bg: "var(--accent)", fg: "#fff" }, soft: { bg: "var(--accent-soft)", fg: "var(--accent)" }, green: { bg: "var(--green-soft)", fg: "var(--green)" }, amber: { bg: "var(--amber-soft)", fg: "var(--amber)" }, blue: { bg: "var(--blue-soft)", fg: "var(--blue)" }, dark: { bg: "var(--ink)", fg: "#fff" }, }; const c = map[color] || map.accent; return ( {children} ); } /* ─────────────────────────── CURRENCY ─────────────────────────── */ function fmtXof(n) { // Force pt-PT style: dot as thousands separator return Math.round(n).toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."); } function PriceXof({ amount, size = "md", muted, accent }) { const sizes = { sm: 13, md: 16, lg: 20, xl: 26 }; return ( {fmtXof(amount)} XOF ); } /* ─────────────────────────── PAYMENT BRAND CHIPS ─────────────────────────── */ function PayLogo({ kind, size = 36 }) { const box = { width: size, height: size, borderRadius: 10, display: "grid", placeItems: "center", border: "1px solid var(--border)", background: "var(--surface)", fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 10, letterSpacing: ".02em", }; if (kind === "telecel-money") return
TT
; if (kind === "main") return
; if (kind === "eagb") return
; if (kind === "orange-money") return
OM
; if (kind === "visa") return
VISA
; if (kind === "mastercard") return (
); return
?
; } /* ─────────────────────────── PLACEHOLDER IMAGE ─────────────────────────── */ function Photo({ ratio = "16/10", label = "Photo", tone = "red", radius = 16, style = {} }) { const grad = tone === "red" ? "linear-gradient(135deg, #FCD9DC 0%, #F20318 60%, #8B020E 100%)" : tone === "dark" ? "linear-gradient(135deg, #2A2A2D 0%, #0A0A0B 100%)" : "linear-gradient(135deg, #E9E9EA 0%, #C9C9C9 100%)"; return (
{label}
); } /* ─────────────────────────── SECTION HEADER ─────────────────────────── */ function SectionHead({ title, link, onLink }) { return (

{title}

{link ? ( ) : null}
); } /* ─────────────────────────── BUNDLE CARDS ─────────────────────────── */ // Three layouts driven by Tweaks: feature | list | grid const BUNDLE_TAGS = { bestseller: { label: "Mais vendido", color: "accent" }, recommended: { label: "Recomendado", color: "soft" }, save: { label: "Poupa 20%", color: "green" }, hot: { label: "Promo", color: "amber" }, bestvalue: { label: "Melhor valor", color: "green" }, }; const Perk = ({ text, onDark }) => text ? ( {text} ) : null; function BundleCard({ bundle, layout = "feature", onClick, featured }) { const tag = bundle.tag ? BUNDLE_TAGS[bundle.tag] : null; if (layout === "list") { return ( ); } if (layout === "grid") { return ( ); } // feature (default) return ( ); } /* ─────────────────────────── PROMO CAROUSEL ─────────────────────────── */ // Edit slides here: image, alt text, CTA label, and either href (USSD/URL) or to (in-app screen). const PROMO_SLIDES = [ { img: "assets/promo-telezap.png", alt: "teleZAP — WhatsApp a zero francos. Marca *638*4#", cta: "Ativar *638*4#", href: "tel:*638*4%23" }, { img: "assets/promo-bombastico.png", alt: "Bombástico — 500 CFA: 5 GB + 500 min, válido até à meia-noite", cta: "Ativar oferta", to: "promotions" }, { img: "assets/promo-whatsapp.png", alt: "teleZAP — WhatsApp sem limites", cta: "Ativar *638*4#", href: "tel:*638*4%23" }, ]; function PromoCarousel({ go, slides = PROMO_SLIDES, interval = 5000 }) { const track = useRef(null); const [idx, setIdx] = useState(0); const [paused, setPaused] = useState(false); const goTo = (i) => { const el = track.current; if (!el) return; const n = (i + slides.length) % slides.length; el.scrollTo({ left: n * el.clientWidth, behavior: "smooth" }); setIdx(n); }; useEffect(() => { if (paused) return; const t = setInterval(() => goTo(idx + 1), interval); return () => clearInterval(t); }, [idx, paused]); const onScroll = () => { const el = track.current; if (!el) return; const n = Math.round(el.scrollLeft / el.clientWidth); if (n !== idx) setIdx(n); }; const act = (s) => { if (s.href) window.open(s.href, "_self"); else if (s.to) go(s.to); }; return (
setPaused(true)} onMouseLeave={() => setPaused(false)} onTouchStart={() => setPaused(true)}>
{slides.map((s, i) => (
{s.alt} act(s)} />
))}
{slides.map((_, i) => )}
); } /* ─────────────────────────── EXPORT ─────────────────────────── */ Object.assign(window, { // hooks useState, useEffect, useRef, useMemo, createContext, useContext, // icons IconHome, IconHomeFilled, IconBundles, IconBolt, IconGrid, IconHeadset, IconUser, IconSearch, IconBell, IconChevronLeft, IconChevronRight, IconChevronDown, IconChevronUp, IconClose, IconPlus, IconCheck, IconCheckCircle, IconWifi, IconPhone, IconMessage, IconClock, IconGift, IconStar, IconStarFilled, IconWhatsapp, IconShield, IconCreditCard, IconWallet, IconGlobe, IconChart, IconArrowRight, IconArrowDown, IconRefresh, IconLogout, IconEye, IconLock, IconHelp, IconSparkle, IconPlay, IconMusic, IconYoutube, IconTiktok, IconFacebook, IconInstagram, IconMoon, IconContact, IconHeart, IconBulb, IconCopy, Perk, // primitives Logo, StatusBar, TopBar, Avatar, BottomNav, SideNav, useIsDesktop, Chip, Tag, PriceXof, fmtXof, PayLogo, Photo, SectionHead, BundleCard, NAV_ITEMS, PromoCarousel, PROMO_SLIDES, });