feat(notifications): add in-app price alert notification polling and drawer display (closes #883) - #907
Open
Ranjeet2063 wants to merge 1 commit into
Conversation
…drawer display (closes accesslayerorg#883) - Introduce AlertService in src/services/alert.service.ts for fetching active price alerts, key prices, and marking triggered alerts - Wire price alert threshold evaluation into useNotifications polling loop (checks above/below threshold crossing) - Update notification type and drawer UI in NotificationBell to render price alert details (key name, direction, target price, current price) - Mark triggered alerts on backend and remove from active monitoring to prevent duplicate notifications - Add comprehensive vitest suite in usePriceAlertNotifications.test.ts
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.
Summary
Closes #883
Adds in-app price alert notification polling to the 60-second notification cycle, checks active price alerts against current key prices, marks triggered alerts on the backend via
PATCH /alerts/:alertId/triggered, and displays actionable price alerts in the notification drawer.Key Changes
src/services/alert.service.ts):AlertServicewithgetActiveAlerts(userId),getKeyPrice(keyId), andmarkAlertTriggered(alertId).src/hooks/useNotifications.ts):checkPriceAlerts:aboveandbelowtarget price directions on each poll.alertService.markAlertTriggered(alert.id)and removes them from active monitoring.triggeredAlertsRefto prevent any duplicate notifications.unreadCount.src/components/common/NotificationBell.tsx,src/services/notification.service.ts):'price_alert'toNotificationTypeunion.BellRingicon rendering forprice_alertevents in the drawer with key name, direction, target price, and current price.src/hooks/__tests__/usePriceAlertNotifications.test.ts):Verification
pnpm test src/hooks/__tests__/usePriceAlertNotifications.test.ts src/hooks/__tests__/useNotifications.test.ts src/components/common/__tests__/NotificationBell.test.tsx: 3/3 test suites, 25/25 tests passed.npx eslint: 0 errors.pnpm run build(tsc -b && vite build): Succeeded with 0 errors.