// ===== SCREENS: Offices, PHOrdinances, Alerts, Profile =====
// ---------- Traffic Offices Directory ----------
function OfficesScreen({ t, go }) {
const [open, setOpen] = useState(1);
return (
๐ Official Philippine traffic management offices. Tap a card to view contact details, then call or email directly.
{ph_offices.map(o => {
const isOpen = open === o.id;
return (
{o.addr}
{o.tel} ยท {o.email}
);
})}
);
}
// ---------- Philippine Ordinances ----------
function PHOrdinancesScreen({ t, go }) {
const [city, setCity] = useState(ph_ordinances[0].city);
const current = ph_ordinances.find(c => c.city === city);
return (
{ph_ordinances.map(c =>
setCity(c.city)} color={c.color}>{c.city})}
๐๏ธ
{current.city}
{current.list.length} local traffic ordinances
{current.list.map((o, i) => (
0 ? `1px solid ${t.border}` : 'none' }}>
{i + 1}
{o}
))}
go('Offices')} icon="shield">Contact Traffic Office
);
}
// ---------- Notifications ----------
function AlertsScreen({ t, go }) {
const [groups, setGroups] = useState(notifs);
const unread = groups.flatMap(g => g.items).filter(i => i.unread).length;
const markAll = () => setGroups(gs => gs.map(g => ({ ...g, items: g.items.map(i => ({ ...i, unread: false })) })));
const tap = (gid, iid) => setGroups(gs => gs.map(g => g.id === gid ? { ...g, items: g.items.map(i => i.id === iid ? { ...i, unread: false } : i) } : g));
return (
{unread > 0 ? `${unread} unread` : 'All caught up ๐'}
{unread > 0 && }
{groups.map(g => (
{g.group}
{g.items.map(n => (
tap(g.id, n.id)} style={{ opacity: n.unread ? 1 : 0.66, transition: 'opacity 0.3s', cursor: 'pointer' }}>
{n.title}
{n.desc}
{n.time} ago
{n.unread &&
}
))}
))}
);
}
// ProfileScreen lives in src/screens-account.jsx (role-aware version)
Object.assign(window, { OfficesScreen, PHOrdinancesScreen, AlertsScreen });