// mb-notifs.jsx — Notification center (bell) const NOTIF_META = { status: { ic: "bike", bg: "var(--accent-50)", fg: "var(--accent)" }, turbo: { ic: "bolt", bg: "var(--turbo-grad)", fg: "#fff", fill: true }, agenda: { ic: "clock", bg: "var(--accent-50)", fg: "var(--accent)" }, promo: { ic: "bolt", bg: "var(--turbo-grad)", fg: "#fff", fill: true }, novolar: { ic: "home", bg: "var(--accent-50)", fg: "var(--accent)" }, cashback: { ic: "coin", bg: "var(--cb-bg)", fg: "var(--cb)" }, lead: { ic: "headset", bg: "var(--accent-50)", fg: "var(--accent)" }, }; function NotificationsCenter({ list, setList, onBack, onToast }) { const groups = ["Recentes", "Hoje", "Esta semana"]; const markAll = () => { setList(l => l.map(n => ({ ...n, unread: false }))); API.me.markNotifsRead().catch(() => {}); onToast("Tudo marcado como lido"); }; const tap = (id) => setList(l => l.map(n => n.id === id ? { ...n, unread: false } : n)); const anyUnread = list.some(n => n.unread); return (
Marcar lidas ) : null} />
{groups.map(g => { const items = list.filter(n => n.group === g); if (!items.length) return null; return (
{g}
{items.map(n => { const m = NOTIF_META[n.kind]; return ( ); })}
); })}
Você está em dia ✨
); } const unreadCount = (l) => (l || NOTIFS).filter(n => n.unread).length; Object.assign(window, { NotificationsCenter, unreadCount });