// screens-home.jsx — Home Dashboard with 3 hero variants
const QUICK_AMOUNTS = [500, 1000, 2000, 5000];
const HOME_BUNDLES = [getBundle("net1000"), getBundle("net100"), getBundle("boss5000")];
const HOME_CATS = [
{ id: "internet", label: "Internet", Icon: IconGlobe, tone: "var(--accent)" },
{ id: "voz", label: "Voz", Icon: IconPhone, tone: "var(--blue)" },
{ id: "combo", label: "Combo", Icon: IconBolt, tone: "var(--green)" },
];
function InternetSpotlight({ go, desktop }) {
const list = bundlesByCat("internet");
return (
Pacotes de Internet
Dobro dos dados com TeleTaku
{list.map(b => (
))}
);
}
const HOME_PROMOS = [
{ eyebrow: "Internet · TeleTaku", title: "3 GB por\n1.000 XOF", body: "Em vez de 1,3 GB. Válido 7 dias.", cta: "Comprar agora", tone: "red", id: "net1000", method: "teletaku" },
{ eyebrow: "Tele Boss", title: "Ilimitado\n+ 50 GB", body: "Chamadas ilimitadas · 15 dias · 10.000 XOF.", cta: "Comprar", tone: "dark", id: "boss10000" },
{ eyebrow: "Voz 24h", title: "Fala à vontade\npor 150 XOF.", body: "Chamadas ilimitadas, todas as redes, com TeleTaku.", cta: "Ativar", tone: "red", id: "voz200", method: "teletaku" },
];
/* ─────────────────────────── HEADER ─────────────────────────── */
function HomeHeader({ user, go }) {
return (
<>
Olá,
{user.name}
{user.phone}
>
);
}
/* ─────────────────────────── HERO VARIANTS ─────────────────────────── */
function HeroBalance({ user, go, desktop }) {
return (
Saldo principal
{fmtXof(user.balance)} XOF
);
}
function BalanceMicroCards({ user, desktop }) {
const cards = [
{ label: "Dados", value: user.data, unit: "GB", Icon: IconGlobe, tone: "var(--accent)" },
{ label: "Voz", value: user.voice, unit: "MIN", Icon: IconPhone, tone: "var(--blue)" },
{ label: "SMS", value: user.sms, unit: "msg", Icon: IconMessage, tone: "var(--green)" },
];
return (
{cards.map((c) => (
{c.label}
{c.value} {c.unit}
))}
);
}
function HeroPromo({ go }) {
const p = HOME_PROMOS[0];
return (
{p.eyebrow}
{p.title}
{p.body}
);
}
function HeroQuickRecharge({ user, go }) {
const [amount, setAmount] = useState(1000);
return (
Recarga rápida
{user.phone}
{QUICK_AMOUNTS.map(a => (
setAmount(a)}>{fmtXof(a)} XOF
))}
);
}
/* ─────────────────────────── LOYALTY HERO ─────────────────────────── */
function LoyaltyHero({ user, go, desktop }) {
const pct = Math.min(1, user.tierProgress / user.tierTarget);
return (
);
}
/* ─────────────────────────── HOME SCREEN ─────────────────────────── */
function ScreenHome({ go, user, tweaks, isDesktop }) {
const heroOrder = tweaks.homeHero;
return (
<>
{isDesktop ? (
/* Desktop dashboard grid */
{/* Always show balance hero on desktop */}
{/* Balance micro cards */}
{/* Promo carousel */}
{/* Recommended */}
go("bundles")} />
{HOME_BUNDLES.map((b, i) => (
go("bundle-detail", { id: b.id })} featured={i === 0 && tweaks.bundleLayout === "grid"} />
))}
{/* Categories */}
go("bundles")} />
{HOME_CATS.map(c => (
))}
{/* Right rail */}
{[
{ id: "recharge", label: "Recarga", Icon: IconBolt },
{ id: "bundles", label: "Pacotes", Icon: IconBundles },
{ id: "recharge-other", label: "Outro Nº", Icon: IconContact },
{ id: "payment-methods", label: "Carteira", Icon: IconWallet },
].map(a => (
))}
go("transactions")} />
{[
{ label: "Recarga +245 96 660 14 29", sub: "TeleTaku · há 2h", amount: -1000 },
{ label: "Internet Semanal · 3 GB", sub: "TeleTaku · há 1 dia", amount: -1000 },
{ label: "Recarga p/ Aissatu Camará", sub: "Saldo principal · há 3 dias", amount: -500 },
].map((t, i) => (
))}
) : (
<>
{/* MOBILE: existing layout */}
{heroOrder === "balance" &&
}
{heroOrder === "promo" &&
}
{heroOrder === "quick-recharge" &&
}
{[
{ id: "recharge", label: "Recarga", Icon: IconBolt },
{ id: "bundles", label: "Pacotes", Icon: IconBundles },
{ id: "recharge-other", label: "Outro Nº", Icon: IconContact },
{ id: "payment-methods", label: "Carteira", Icon: IconWallet },
].map(a => (
))}
{heroOrder !== "promo" ? (
<>
go("promotions")} />
>
) : null}
go("bundles")} />
{HOME_BUNDLES.slice(0, tweaks.bundleLayout === "list" ? 3 : 2).map((b, i) => (
go("bundle-detail", { id: b.id })} featured={i === 0 && tweaks.bundleLayout === "grid"} />
))}
go("bundles")} />
{HOME_CATS.map(c => (
))}
go("transactions")} />
{[
{ label: "Recarga +245 96 660 14 29", sub: "TeleTaku · há 2h", amount: -1000, ok: true },
{ label: "Internet Semanal · 3 GB", sub: "TeleTaku · há 1 dia", amount: -1000, ok: true },
{ label: "Recarga p/ Aissatu Camará", sub: "Saldo principal · há 3 dias", amount: -500, ok: true },
].map((t, i) => (
))}
>
)}
>
);
}
Object.assign(window, { ScreenHome });