// Account.jsx — Mi cuenta with sidebar tabs (profile, addresses, payments, orders, favorites, settings)
const { useState: useAcctState } = React;
const ACCT_SECTIONS = [
{ id: "compras", label: "Mis compras", icon: "shopping_basket" },
{ id: "favoritos", label: "Mis favoritos", icon: "favorite" },
{ id: "perfil", label: "Mi perfil", icon: "person" },
{ id: "direcciones", label: "Mis direcciones",icon: "location_on" },
{ id: "pagos", label: "Métodos de pago",icon: "credit_card" },
{ id: "ajustes", label: "Ajustes", icon: "tune" },
];
const AccountPage = ({ user, params, onNav, onLogout, onOpenPdp, onOpenOrder, favs, onUnfav }) => {
const [tab, setTab] = useAcctState(params?.tab || "compras");
const initials = (user?.name || "Allen").split(/\s+/).map(s => s[0]).slice(0, 2).join("").toUpperCase();
const toast = useToast();
return (
s.id === tab)?.label]} />
{/* SIDEBAR */}
{initials}
{user?.name || "Usuario Allen"}
{user?.email || "tu@correo.com"}
{ACCT_SECTIONS.map(s => (
setTab(s.id)}
style={{
display: "flex", alignItems: "center", gap: 12,
padding: "10px 14px", borderRadius: "var(--radius-md)",
background: tab === s.id ? "var(--primary-soft)" : "transparent",
color: tab === s.id ? "var(--primary-press)" : "var(--fg-strong)",
border: 0, font: tab === s.id ? "700 13px var(--font-sans)" : "500 13px var(--font-sans)",
cursor: "pointer", textAlign: "left",
}}
onMouseEnter={e => { if (tab !== s.id) e.currentTarget.style.background = "var(--bg-elev-2)"; }}
onMouseLeave={e => { if (tab !== s.id) e.currentTarget.style.background = "transparent"; }}
>
{s.label}
{tab === s.id && }
))}
Cerrar sesión
{/* CONTENT */}
{tab === "compras" && }
{tab === "favoritos" && }
{tab === "perfil" && }
{tab === "direcciones" && }
{tab === "pagos" && }
{tab === "ajustes" && }
);
};
// ----- Orders -----
const ORDERS = [
{ id: "AL-712304", date: "12 feb 2026", status: "DELIVERED", items: [{ pid: "p001", qty: 1 }, { pid: "p008", qty: 1 }], total: 2548 },
{ id: "AL-711981", date: "08 feb 2026", status: "IN_PROGRESS",items: [{ pid: "p005", qty: 1 }], total: 1899 },
{ id: "AL-711440", date: "30 ene 2026", status: "DELIVERED", items: [{ pid: "p003", qty: 2 }, { pid: "p010", qty: 1 }], total: 1017 },
{ id: "AL-710882", date: "14 ene 2026", status: "CANCELLED", items: [{ pid: "p007", qty: 1 }], total: 5499 },
];
const STATUS_LABEL = {
REQUESTED: { label: "Solicitado", fg: "var(--warning)", bg: "var(--warning-bg)" },
ACCEPTED: { label: "Aceptado", fg: "var(--primary-press)", bg: "var(--primary-soft)" },
IN_PROGRESS: { label: "En camino", fg: "#8A6500", bg: "var(--warning-bg)" },
READY: { label: "Listo", fg: "var(--success)",bg: "var(--success-bg)" },
DELIVERED: { label: "Entregado", fg: "var(--success)",bg: "var(--success-bg)" },
CANCELLED: { label: "Cancelado", fg: "var(--error)", bg: "var(--error-bg)" },
};
const OrdersTab = ({ onOpenPdp, onOpenOrder }) => {
const [filter, setFilter] = useAcctState("all");
const filtered = filter === "all" ? ORDERS : ORDERS.filter(o => o.status === filter);
return (
Mis compras
{ORDERS.length} pedidos en total
{[
{ id: "all", label: "Todas" },
{ id: "IN_PROGRESS", label: "En camino" },
{ id: "DELIVERED", label: "Entregadas" },
{ id: "CANCELLED", label: "Canceladas" },
].map(f => (
setFilter(f.id)}
style={{
padding: "8px 16px", borderRadius: "9999px",
background: filter === f.id ? "var(--hub-black)" : "var(--bg-elev-1)",
color: filter === f.id ? "#fff" : "var(--fg-strong)",
border: filter === f.id ? 0 : "1px solid var(--border)",
font: filter === f.id ? "700 12px var(--font-sans)" : "500 12px var(--font-sans)",
cursor: "pointer",
}}>{f.label}
))}
{filtered.map(o => {
const status = STATUS_LABEL[o.status];
const items = o.items.map(i => CATALOG.find(p => p.id === i.pid)).filter(Boolean);
return (
Pedido #{o.id}
{o.date}
{status.label}
{items.map(p => (
onOpenPdp(p)} title={p.name}
style={{ width: 72, height: 72, borderRadius: "var(--radius-md)", padding: 0, border: "1px solid var(--border-soft)", background: p.imgBg, overflow: "hidden", cursor: "pointer" }}>
))}
{items[0]?.name}
{items.length > 1 &&
y {items.length - 1} producto{items.length > 2 ? "s" : ""} más
}
Total
${o.total.toLocaleString("es-MX")}
{o.status === "DELIVERED" && (
Volver a comprar
)}
onOpenOrder?.(o.id)}>Ver detalle
{o.status === "IN_PROGRESS" && (
Llega mañana entre 10:00 y 18:00 · Salió del centro Allen Vallarta · Ver seguimiento
)}
);
})}
);
};
// ----- Favorites -----
const FavoritesTab = ({ favs, onOpenPdp, onUnfav }) => {
const items = CATALOG.filter(p => favs?.has(p.id));
return (
Mis favoritos
{items.length} producto{items.length === 1 ? "" : "s"} guardado{items.length === 1 ? "" : "s"}
{items.length === 0 ? (
) : (
{items.map(p => (
onOpenPdp(p)} onFav={() => onUnfav(p)} onAdd={() => onOpenPdp(p)} />
))}
)}
);
};
// ----- Profile -----
const ProfileTab = ({ user }) => {
const [form, setForm] = useAcctState({
name: user?.name || "Bau Andalón", email: user?.email || "bau@allenmx.com",
phone: "+52 322 145 2287", birthday: "1992-08-12", gender: "no-decir",
});
const toast = useToast();
return (
Mi perfil
Actualiza tus datos personales y de contacto.
{form.name.split(/\s+/).map(s => s[0]).slice(0, 2).join("").toUpperCase()}
{form.name}
Miembro Allen desde 2024 · 4 compras
Cambiar foto
setForm({ ...form, name: e.target.value })} />
setForm({ ...form, email: e.target.value })} />
setForm({ ...form, phone: e.target.value })} />
setForm({ ...form, birthday: e.target.value })} />
toast("Cambios guardados")}>Guardar cambios
Cancelar
);
};
// ----- Addresses -----
const ADDRESSES = [
{ id: "a1", label: "Casa", name: "Bau Andalón", street: "Av. Francisco Villa 1180, Int. 4", area: "Versalles, Puerto Vallarta", state: "Jalisco", zip: "48330", phone: "+52 322 145 2287", default: true },
{ id: "a2", label: "Oficina", name: "Bau Andalón", street: "Calle Honduras 156", area: "5 de Diciembre, Puerto Vallarta", state: "Jalisco", zip: "48350", phone: "+52 322 145 2287" },
];
const AddressesTab = () => (
Mis direcciones
Agregar dirección
La dirección predeterminada se usa en cada compra.
{ADDRESSES.map(a => (
{a.label}
{a.default && Predeterminada }
{a.name}
{a.street}
{a.area}
{a.state} · CP {a.zip}
{a.phone}
{!a.default && (
Hacer predeterminada
)}
))}
Agregar dirección
A casa, oficina, casa de tu mamá…
);
// ----- Payments -----
const CARDS = [
{ id: "c1", brand: "VISA", last4: "4242", exp: "08/28", default: true, gradient: "linear-gradient(135deg, #1F3A93 0%, #0A1740 100%)" },
{ id: "c2", brand: "MASTERCARD", last4: "5588", exp: "11/27", default: false, gradient: "linear-gradient(135deg, #18181B 0%, #3A3A40 100%)" },
];
const PaymentsTab = () => (
Métodos de pago
Agregar tarjeta
Tus datos están cifrados. Nunca guardamos el CVV.
{CARDS.map(c => (
•••• {c.last4}
Bau Andalón
EXP {c.exp}
{c.default && (
Predeterminada
)}
))}
{/* Other payment methods */}
Otros métodos
{[
{ name: "PayPal", icon: "credit_card", bg: "var(--bg-branding)" },
{ name: "Mercado Pago", icon: "credit_card", bg: "#FEF1C7" },
{ name: "OXXO efectivo", icon: "shopping_basket",bg: "var(--orange-bg)" },
].map(m => (
{m.name}
))}
);
// ----- Settings -----
const SettingsTab = () => {
const [s, setS] = useAcctState({ promos: true, orderUpd: true, push: false, sms: true, lang: "es-MX" });
return (
Ajustes
Notificaciones, idioma y preferencias de cuenta.
{[
{ key: "promos", label: "Ofertas y promociones", sub: "Te avisamos cuando algo de tu lista esté en oferta." },
{ key: "orderUpd", label: "Actualizaciones de pedido", sub: "Cuando tu pedido cambia de estado." },
{ key: "push", label: "Notificaciones push", sub: "En tu navegador o app." },
{ key: "sms", label: "SMS", sub: "Para entregas y códigos de seguridad." },
].map((row, i, arr) => (
setS({ ...s, [row.key]: v })} />
))}
Idioma y región
setS({ ...s, lang: e.target.value })}
style={{ ...inputStyle, width: "100%", appearance: "none", backgroundImage: "url(\"data:image/svg+xml;utf8, \")", backgroundRepeat: "no-repeat", backgroundPosition: "right 14px center", paddingRight: 36 }}>
Español (México)
Español (España)
English (US)
Eliminar cuenta
Se borrarán tus pedidos, favoritos y direcciones. No se puede deshacer.
Solicitar eliminación
);
};
const Switch = ({ on, onChange }) => (
onChange(!on)} style={{ width: 48, height: 28, borderRadius: 14, background: on ? "var(--primary)" : "var(--border-strong)", border: 0, cursor: "pointer", position: "relative", transition: "background var(--dur-fast)" }}>
);
const EmptyBox = ({ icon, title, sub }) => (
);
const outlineBtn = { background: "var(--bg-elev-1)", color: "var(--fg-strong)", border: "1px solid var(--border-strong)", padding: "8px 16px", borderRadius: "9999px", font: "600 12px var(--font-sans)", cursor: "pointer" };
const ghostBtn = { background: "transparent", color: "var(--primary)", border: 0, font: "700 13px var(--font-sans)", cursor: "pointer" };
const iconChipBtn = { width: 32, height: 32, borderRadius: 16, background: "var(--bg-elev-2)", border: 0, display: "grid", placeItems: "center", cursor: "pointer", color: "var(--fg-muted)" };
window.AccountPage = AccountPage;
// Status table reused by OrderDetail.jsx
Object.assign(window, { STATUS_LABEL });