mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-21 14:21:46 +00:00
feat: add in-app notification system with real-time delivery
Introduces a full in-app notification system with three types (simple, boolean with server-side callbacks, navigate), three scopes (user, trip, admin), fan-out persistence per recipient, and real-time push via WebSocket. Includes a notification bell in the navbar, dropdown, dedicated /notifications page, and a dev-only admin tab for testing all notification variants. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
type ActionHandler = (payload: Record<string, unknown>, respondingUserId: number) => Promise<void>;
|
||||
|
||||
const actionRegistry = new Map<string, ActionHandler>();
|
||||
|
||||
function registerAction(actionType: string, handler: ActionHandler): void {
|
||||
actionRegistry.set(actionType, handler);
|
||||
}
|
||||
|
||||
function getAction(actionType: string): ActionHandler | undefined {
|
||||
return actionRegistry.get(actionType);
|
||||
}
|
||||
|
||||
// Dev/test actions
|
||||
registerAction('test_approve', async () => {
|
||||
console.log('[notifications] Test approve action executed');
|
||||
});
|
||||
|
||||
registerAction('test_deny', async () => {
|
||||
console.log('[notifications] Test deny action executed');
|
||||
});
|
||||
|
||||
export { registerAction, getAction };
|
||||
Reference in New Issue
Block a user