/* Banyan Pharmacy — Alerts (the loop hinge; format-aware urgency) */ const { useState: useStateA } = React; const URG = { critical: { label: "Critical", icon: (p) => }, transfer: { label: "Transfer", icon: (p) => }, expiry: { label: "Expiry", icon: (p) => }, }; function AlertCard({ alert, resolved, onAct, focus }) { const app = useApp(); const store = D.storeById[alert.storeId]; const status = window.storeStatusAt(store, app.stage); const U = URG[alert.urgency]; const back = alert.urgency === "critical" ? "Courier confirmed — sent back to the Mukundapur chat." : alert.urgency === "transfer" ? "Transfer arranged — sent back to the Gariahat chat." : "Transfer arranged — Behala → Park Street."; return (
{alert.what}
{alert.chat && (
{alert.chatFrom}
“{alert.chat}”
)}
Suggested action · from Terrace
{alert.action}
{resolved ? ( {back} ) : ( )}
); } function AlertsPage() { const app = useApp(); const [resolved, setResolved] = useStateA({}); const alerts = window.alertsAt(app.stage); const focusId = app.loopFocus && app.loopFocus.kind === "alert" ? app.loopFocus.id : null; const act = (id) => { setResolved((r) => ({ ...r, [id]: true })); }; const openCount = alerts.filter((a) => !resolved[a.id]).length; return (

Alerts

Store-raised support requests — “we're out of X, centre please help.” {openCount} open · urgency reflects store format.
{alerts.map((a) => ( ))} {!alerts.length &&
No open alerts. The chain is steady.
}
This is where the centre acts and value returns to the edge. Terrace's judgment adapts to store format — a hospital stockout is critical and expedited; a neighbourhood chronic-med is a routine next-day transfer.
); } window.Pages = window.Pages || {}; window.Pages.Alerts = AlertsPage;