2026-07-13 17:44:44 +03:30
|
|
|
---
|
2026-07-18 16:57:13 +03:30
|
|
|
description: Sidebar tab badges (Cases/Tasks/Treatment) — activity model, tab-counts API, read cursors
|
2026-07-13 17:44:44 +03:30
|
|
|
globs: backend/src/modules/notifications/**,backend/src/common/lab-case-activity.ts,frontend/src/lib/hooks/useTabBadgeCounts.ts,frontend/src/lib/tabBadgeUtils.ts,frontend/src/lib/api/notifications.ts,frontend/src/components/ui/shared/NavBadgePill.tsx,frontend/src/components/ui/shared/Sidebar.tsx
|
|
|
|
|
alwaysApply: false
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-18 16:57:13 +03:30
|
|
|
# Tab badges (Cases / Tasks / Treatment)
|
2026-07-13 17:44:44 +03:30
|
|
|
|
2026-07-18 17:23:47 +03:30
|
|
|
- **Split counts (Option B):** Lab Cases = sent + clinic comments + important; Lab Tasks = completions + lab comments + assignments (assignee-only); Clinic Treatment = visible lab comments + completions.
|
2026-07-18 16:57:13 +03:30
|
|
|
- **API:** `GET /notifications/tab-counts`; **Cases + Treatment** use per-case read + `hasUnread` on list cards; Tasks marks read on tab visit. Treatment rail uses `TreatmentLabCasesPanel` + `LabCaseTrackerCard` + activity feed.
|
2026-07-13 17:44:44 +03:30
|
|
|
- **Pattern:** `useTabBadgeCounts` + `notifyTabBadgesChanged()` — same shape as `usePendingConnectionsCount`.
|
2026-07-18 16:57:13 +03:30
|
|
|
- **Live:** inbox Socket.IO `notification.created` → `notifyTabBadgesChanged()` (and org pending event when relevant). **Mounted** Cases/Tasks/Treatment/Orgs pages soft-refetch lists; unmounted tabs do not. Sidebar badge counts always refetch (hook is always mounted).
|
2026-07-13 17:44:44 +03:30
|
|
|
- **Orgs connections badge** stays on separate `pending-count` endpoint.
|
2026-07-18 01:09:54 +03:30
|
|
|
- **Header inbox** (bell) is separate — `.cursor/skills/notifications-inbox/SKILL.md`.
|
2026-07-13 17:44:44 +03:30
|
|
|
|
2026-07-18 16:57:13 +03:30
|
|
|
Full map: `.cursor/skills/tab-badges/SKILL.md`
|