Topbar unread drawer #28

Merged
archvillainette merged 8 commits from feat/topbar-unread-drawer into main 2026-07-17 16:43:12 +00:00
Owner

Adds an Unread dropdown to the topbar utilities (before notifications), per docs/superpowers/plans/2026-07-17-topbar-unread-drawer.md.

  • New partial templates/partials/header/unread-drawer.tpl: toggle with live component="unread/count" badge (core socket updates), server-rendered empty/footer rows.
  • public/client.js: on dropdown open, fetches GET /api/unread and injects up to 10 topic rows (titles/categories via textContent only); fetch failure falls back to the empty state.
  • Mobile burger drawer gets an Unread row with the same badge.
  • SCSS: unread dropdown joins the shared dropdown width rule; flex row styles for topic items.

Deviations from the plan's example code, found by live verification against the dev forum:

  • Plan's api.get('/unread') hits the v3 write API and 404s → replaced with a fetch of the /api/unread read route.
  • NodeBB 4 has no global window.require, so runtime translation of the static [[unread:...]] strings never ran → those strings are now server-rendered in the template (also removes the plan's translate-over-innerHTML step, which would have re-parsed untrusted titles as HTML).

Verified: full plain-node test suite passes; Playwright against the dev container passed all checks (badge count, item ordering before notifications, dropdown topic links + navigation, /unread footer link, mobile drawer badge at 390px).

🤖 Generated with Claude Code

Adds an Unread dropdown to the topbar utilities (before notifications), per docs/superpowers/plans/2026-07-17-topbar-unread-drawer.md. - New partial `templates/partials/header/unread-drawer.tpl`: toggle with live `component="unread/count"` badge (core socket updates), server-rendered empty/footer rows. - `public/client.js`: on dropdown open, fetches `GET /api/unread` and injects up to 10 topic rows (titles/categories via textContent only); fetch failure falls back to the empty state. - Mobile burger drawer gets an Unread row with the same badge. - SCSS: unread dropdown joins the shared dropdown width rule; flex row styles for topic items. Deviations from the plan's example code, found by live verification against the dev forum: - Plan's `api.get('/unread')` hits the v3 write API and 404s → replaced with a fetch of the `/api/unread` read route. - NodeBB 4 has no global `window.require`, so runtime translation of the static `[[unread:...]]` strings never ran → those strings are now server-rendered in the template (also removes the plan's translate-over-innerHTML step, which would have re-parsed untrusted titles as HTML). Verified: full plain-node test suite passes; Playwright against the dev container passed all checks (badge count, item ordering before notifications, dropdown topic links + navigation, /unread footer link, mobile drawer badge at 390px). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
archvillainette added 8 commits 2026-07-17 16:37:41 +00:00
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Translating menuEl.innerHTML re-serialized untrusted topic titles into
HTML and reinjected them via innerHTML. Translate only the two static
placeholder strings ([[unread:no-unread-topics]], [[unread:title]])
via a small textContent-based helper instead.
require(['api']).api.get() targets NodeBB's v3 write API and 404s on
/api/v3/unread. Use a plain fetch against the read route /api/unread instead.
window.require is undefined in the NodeBB 4 webpack client build, so the
translateText helper never ran and unread drawer strings rendered as raw
[[unread:title]] / [[unread:no-unread-topics]]. Move the static strings into
the benchpress template (translated at render time) and have client.js only
manage the topic <li> rows.
archvillainette scheduled this pull request to auto merge when all checks succeed 2026-07-17 16:42:18 +00:00
xtul approved these changes 2026-07-17 16:43:11 +00:00
archvillainette merged commit 004be9b038 into main 2026-07-17 16:43:12 +00:00
archvillainette deleted branch feat/topbar-unread-drawer 2026-07-17 16:43:12 +00:00
Sign in to join this conversation.