From 65069ddebd8a8fe0c00eb1f2d57641ba1631ed4f Mon Sep 17 00:00:00 2001 From: vickydotbat Date: Fri, 17 Jul 2026 18:10:41 +0200 Subject: [PATCH] feat: add unread drawer button to topbar --- templates/partials/header/topbar.tpl | 5 ++++ templates/partials/header/unread-drawer.tpl | 7 ++++++ tests/global-topbar-contract.test.js | 26 +++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 templates/partials/header/unread-drawer.tpl diff --git a/templates/partials/header/topbar.tpl b/templates/partials/header/topbar.tpl index 67ce13f..5938994 100644 --- a/templates/partials/header/topbar.tpl +++ b/templates/partials/header/topbar.tpl @@ -37,6 +37,10 @@ {{{ end }}} + + @@ -109,6 +113,7 @@ {{{ if config.loggedIn }}}
+ [[unread:title]]{unreadCount.topic} [[global:header.notifications]]{unreadCount.notification} {{{ if canChat }}} [[global:header.chats]]{unreadCount.chat} diff --git a/templates/partials/header/unread-drawer.tpl b/templates/partials/header/unread-drawer.tpl new file mode 100644 index 0000000..da0f781 --- /dev/null +++ b/templates/partials/header/unread-drawer.tpl @@ -0,0 +1,7 @@ + + diff --git a/tests/global-topbar-contract.test.js b/tests/global-topbar-contract.test.js index 0f31f82..5c15741 100644 --- a/tests/global-topbar-contract.test.js +++ b/tests/global-topbar-contract.test.js @@ -148,3 +148,29 @@ assertExcludes( 'brand-header', 'Removed brand banner widget area should not remain registered' ); + +const unreadDrawer = read('templates/partials/header/unread-drawer.tpl'); +assertIncludes( + topbar, + '', + 'Topbar should mount the unread drawer before notifications' +); +assert( + topbar.indexOf('partials/header/unread-drawer.tpl') < topbar.indexOf('partials/sidebar/notifications.tpl'), + 'Unread drawer should sit before the notifications item' +); +assertIncludes( + unreadDrawer, + 'component="unread/count"', + 'Unread toggle should carry the live core count badge' +); +assertIncludes( + unreadDrawer, + 'data-wg-unread-menu', + 'Unread dropdown menu should expose the JS mount hook' +); +assertMatches( + topbar, + /href="\{relative_path\}\/unread"[^>]*>[\s\S]*?component="unread\/count"/, + 'Mobile drawer actions should include an Unread link with count badge' +);