feat: add notification bell in nav bar with unread badge and dropdown… - #740
Merged
Chucks1093 merged 2 commits intoJul 30, 2026
Merged
Conversation
…ccesslayerorg#720 - Add NotificationBell component (src/components/common/NotificationBell.tsx) - Bell icon in the nav bar using lucide-react Bell icon - Unread count badge (red, capped at 99+) visible only when count > 0 - Radix DropdownMenu shows up to 5 most recent notifications - Each item shows message, relative time (via formatRelativeTime), and an unread indicator dot - Clicking an item calls markAsRead() then navigates to notification.href - View all link at the bottom navigates to /notifications - Accessible aria-label includes unread count when present - Loading skeleton rows while query is in flight - Empty state when no notifications exist - Add notification.service.ts (src/services/notification.service.ts) - Extends BaseApiService following existing service pattern - getNotifications(userId) - GET /notifications - markAsRead(notificationId) - PATCH /notifications/:id/read - Notification, NotificationType, NotificationsResponse types exported - Add useNotifications hook (src/hooks/useNotifications.ts) - Wraps useQuery for data fetching (queryFn injected for testability) - Wraps useMutation for markAsRead with optimistic update: flips read flag and decrements unreadCount immediately, rolls back on error, invalidates on settled - Caps recent array at 5 items for dropdown display - Disabled when userId is empty - Add notifications query key family (src/lib/queryKeys.ts) - queryKeys.notifications.all() - queryKeys.notifications.list(userId) - Update Header (src/components/home/Header.tsx) - Import NotificationBell and useProfileStore - Render <NotificationBell userId={profile.id} /> when profile is set, placed left of WalletStatusChip in a flex gap-2 wrapper - Add /notifications route (src/routes.tsx + src/pages/NotificationsPage.tsx) - Full-page notifications list matching View all destination - Uses the same useNotifications hook and formatRelativeTime - Add tests - src/hooks/__tests__/useNotifications.test.ts: loading state, empty, data resolved, 5-item cap, disabled when no userId, optimistic update - src/components/common/__tests__/NotificationBell.test.tsx: badge visibility, 99+ cap, accessible labels, dropdown open, empty state, skeleton, 5 items rendered, message text, markAsRead called on click, View all link, badge decrement after read
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #720
Add NotificationBell component (src/components/common/NotificationBell.tsx)
Add notification.service.ts (src/services/notification.service.ts)
Add useNotifications hook (src/hooks/useNotifications.ts)
Add notifications query key family (src/lib/queryKeys.ts)
Update Header (src/components/home/Header.tsx)
Add /notifications route (src/routes.tsx + src/pages/NotificationsPage.tsx)
Add tests
Summary
Testing
pnpm lintpnpm buildChecklist