2bec205a30
- Bell icon in icon registry (Phosphor Bell) - NotificationProvider context with polling (15s unread / 30s list) - useNotifications() hook with optimistic updates - NotificationCenter component: bell + badge + dropdown panel - NotificationItem component: severity icon, title, relative time, actions - AppShell integration: mount in header-actions, hidden on mobile - CSS styles: dropdown, items, unread/read states, empty state - formatRelativeTime utility (custom, no new deps) - 25 frontend tests (9 hook + 6 item + 10 center) Quality gates: vitest 25 passed, tsc clean, eslint clean
13 lines
301 B
TypeScript
13 lines
301 B
TypeScript
import { useContext } from "react";
|
|
import { NotificationContext } from "../state/notifications";
|
|
|
|
export function useNotifications() {
|
|
const ctx = useContext(NotificationContext);
|
|
if (!ctx) {
|
|
throw new Error(
|
|
"useNotifications must be used within NotificationProvider",
|
|
);
|
|
}
|
|
return ctx;
|
|
}
|