Repository navigation
MC-46: show unread notifications in the browser tab (favicon bell badge and title count) - #9
Conversation
…abs and devices Before, marking a notification read (or "Mark all read") sent no live event, so a second MegooColab tab or device kept its bell count until a reload. Both endpoints now publish notification.read when something actually became read, mirroring service.read_by_acting. MC-46's tab badge needs it so the favicon bell and "(3)" title clear everywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TabBadge reads the shared unread count and marks the tab: a bell on the favicon and the count before the title. It re-applies on every page change, since the head's icon links and title may be re-rendered, and clears both when the signed-in layout goes away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The notifications end-to-end test now checks that while Bea has unread notifications her tab title starts with the count and every favicon link points at the badged drawing, also after a client-side page change and in a second tab. Marking everything read in one tab clears the title and icon in the other through the server's notification.read event. The README describes the new section, and docs/install.md tells people what the tab shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mmhy2003
left a comment
There was a problem hiding this comment.
Verdict: approved
The change matches the approved design and plan (mockup v2). The favicon bell badge is drawn on a canvas over the real icon and only rel~="icon" links change, so the Apple touch icon and manifest icons stay as they are. The title gets a (N) prefix, written 99+ above 99 like the bell. TabBadge is mounted only when signed in. It marks the tab again on every page change and takes the marks away on unmount. On the backend, both mark-as-read endpoints now publish notification.read, and only when something actually became read, so other tabs and devices clear their marks.
Unit tests cover the drawing and its failure cases (load error, no 2D canvas, late load after turning off, drawn once), the title prefix and TabBadge. The backend test covers someone else's notification, an already-read one and an empty read-all. Section 7 of the e2e test covers the badge after a page change and in a second tab. All CI checks pass.
Minor, not blocking: the PR description says the Playwright spec was not re-run in the finishing step. That spec is the only check that the title prefix and the badged icon survive a client-side page change in a real browser.
MC-46: unread notifications in the browser tab
What changed
frontend/src/lib/favicon.tsdraws a small red bell badge over the real favicon on a canvas. It switches everylink[rel~="icon"]between the normal icon and the badged one. If drawing fails, the icon is left as it is.frontend/src/lib/title.tsputs(N)in front of the title (99+above 99), for example(3) Projects · MegooColab.TabBadge: a component that renders nothing, mounted in the signed-in layout. It readsuseUnreadCount()and drives both. When it unmounts (sign-out), the normal favicon and title come back.POST /api/notifications/{id}/readandPOST /api/notifications/read-allnow publish the live eventnotification.read. A second tab or device then clears its bell, badge and title count without a reload.docs/install.md. Design and plan are indocs/superpowers/.Why
When someone works in another tab, they can see at a glance that MegooColab has unread notifications waiting for them. The look follows the approved mockup v2.
How it was tested
npx tsc --noEmitand eslint on the changed files are clean.npm test(Vitest): 1254/1254 passed, including the new favicon, title and TabBadge tests.uv run pytest -n 8: 2040 passed, 1 failed. The failure is the wall-clock benchmarktests/dashboard/test_speed.pyat 306 ms against its 300 ms limit. Run alone, it fails at random on this branch and also on the unchanged base commit, while the machine is under load. This branch doesn't touch the dashboard. New tests check that both read endpoints publishnotification.read.frontend/e2e/notifications.spec.ts(tab badge and title count, also across tabs). It was not re-run in this finishing step.🤖 Generated with Claude Code