Problem
socket.io-client is listed in package.json but there is no WebSocket connection, no event listeners, and no notification UI anywhere in the frontend. Restaurant admins have no way to know when a new order arrives without manually refreshing the page. The backend has socket.io installed, suggesting real-time was planned but never implemented on the client side.
Proposed Solution
- Create
frontend/lib/socket/socketClient.ts establishing a Socket.io connection authenticated with the JWT (passed as handshake auth token)
- Create a
useOrderNotifications() hook that subscribes to order:new and order:status_changed events and shows a persistent toast on new orders
- Add a Zustand
notificationSlice storing unread count and notifications array
- Display an unread badge on the Orders nav item in the admin sidebar
- Clicking the toast navigates to
/admin/orders/{orderId}
Acceptance Criteria
Problem
socket.io-clientis listed inpackage.jsonbut there is no WebSocket connection, no event listeners, and no notification UI anywhere in the frontend. Restaurant admins have no way to know when a new order arrives without manually refreshing the page. The backend hassocket.ioinstalled, suggesting real-time was planned but never implemented on the client side.Proposed Solution
frontend/lib/socket/socketClient.tsestablishing a Socket.io connection authenticated with the JWT (passed as handshake auth token)useOrderNotifications()hook that subscribes toorder:newandorder:status_changedevents and shows a persistent toast on new ordersnotificationSlicestoring unread count and notifications array/admin/orders/{orderId}Acceptance Criteria