// screens-recharge.jsx — Recharge, Buy for another Telecel number, Saved numbers
const FAVORITE_CONTACTS = [
{ name: "Aissatu Camará", phone: "+245 96 712 03 88", initials: "AC", color: "linear-gradient(135deg, #F20318, #8B020E)" },
{ name: "Buba Mané", phone: "+245 96 534 18 02", initials: "BM", color: "linear-gradient(135deg, #1E66F5, #143F99)" },
{ name: "Fatumata Djaló", phone: "+245 96 987 41 22", initials: "FD", color: "linear-gradient(135deg, #19A86B, #0F6E47)" },
{ name: "Mama", phone: "+245 96 610 09 12", initials: "M", color: "linear-gradient(135deg, #9F37E8, #5B1FA0)" },
];
const RECENT_NUMBERS = [
{ phone: "+245 96 712 03 88", label: "Aissatu Camará", last: "Internet 1,3 GB" },
{ phone: "+245 96 534 18 02", label: "Buba Mané", last: "Recarga 2.000 XOF" },
];
function FavoritesRow({ onPick, go }) {
return (
{FAVORITE_CONTACTS.map(c => (
))}
);
}
/* ─────────────────────────── RECHARGE (airtime) ─────────────────────────── */
function ScreenRecharge({ go, user, args }) {
const [target, setTarget] = useState(args?.phone ? "other" : "self");
const [other, setOther] = useState(args?.phone ? normalizeTelecel(args.phone) : "");
const [amount, setAmount] = useState(1000);
const [source, setSource] = useState("teletaku");
const phone = target === "self" ? user.phone : formatTelecel(other);
const valid = target === "self" || isTelecelNumber(other);
return (
<>
go("home")} />
{target === "self"
?
: <>
go("saved-numbers")} />
Favoritos
setOther(normalizeTelecel(p))} go={go} />
>}
Valor
{[500, 1000, 2000, 5000].map(a => (
))}
Pagar com
>
);
}
/* ─────────────────────────── FOR ANOTHER NUMBER ─────────────────────────── */
function ScreenRechargeOther({ go }) {
const [step, setStep] = useState(0);
const [phone, setPhone] = useState("");
const [what, setWhat] = useState("bundle");
const [save, setSave] = useState(true);
const valid = isTelecelNumber(phone);
const internet = bundlesByCat("internet");
const others = BUNDLES.filter(b => b.cat !== "internet");
return (
<>
step ? setStep(0) : go("home")} />
{["Número", "Pacote ou recarga", "Pagamento"].map((s, i) => (
{i + 1}
{s}
{i < 2 ? : null}
))}
{step === 0 ? (
<>
Número Telecel do destinatário
go("saved-numbers")} />
Favoritos
setPhone(normalizeTelecel(p))} go={go} />
Recentes
{RECENT_NUMBERS.map(r => (
))}
>
) : (
<>
{formatTelecel(phone)}
Número Telecel verificado
{what === "bundle" ? (
<>
{internet.map(b => go("bundle-detail", { id: b.id, recipient: normalizeTelecel(phone) })} />)}
{others.map(b => go("bundle-detail", { id: b.id, recipient: normalizeTelecel(phone) })} />)}
>
) : (
)}
>
)}
>
);
}
/* ─────────────────────────── SAVED NUMBERS ─────────────────────────── */
function ScreenSavedNumbers({ go }) {
const [q, setQ] = useState("");
const list = FAVORITE_CONTACTS.filter(c => (c.name + c.phone).toLowerCase().includes(q.toLowerCase()));
return (
<>
go("recharge-other")} right={} />
setQ(e.target.value)} />
{list.map(c => (
{c.initials}
))}
>
);
}
Object.assign(window, { ScreenRecharge, ScreenRechargeOther, ScreenSavedNumbers, FAVORITE_CONTACTS });