feat: update sidebar toggle actions and badge behavior for session state changes

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
mrleemurray
2026-03-30 10:31:06 +01:00
parent 3bc76baebe
commit 2494659e69
3 changed files with 14 additions and 5 deletions

View File

@@ -23,7 +23,6 @@ const sidebarToggleIcon = registerIcon('agent-sidebar-toggle', Codicon.tasklist,
class ToggleSidebarVisibilityAction extends Action2 { class ToggleSidebarVisibilityAction extends Action2 {
static readonly ID = 'workbench.action.agentToggleSidebarVisibility'; static readonly ID = 'workbench.action.agentToggleSidebarVisibility';
static readonly LABEL = localize('compositePart.hideSideBarLabel', "Hide Primary Side Bar");
constructor() { constructor() {
super({ super({
@@ -76,7 +75,6 @@ class ToggleSidebarVisibilityAction extends Action2 {
class ToggleSecondarySidebarVisibilityAction extends Action2 { class ToggleSecondarySidebarVisibilityAction extends Action2 {
static readonly ID = 'workbench.action.agentToggleSecondarySidebarVisibility'; static readonly ID = 'workbench.action.agentToggleSecondarySidebarVisibility';
static readonly LABEL = localize('compositePart.hideSecondarySideBarLabel', "Hide Secondary Side Bar");
constructor() { constructor() {
super({ super({

View File

@@ -87,11 +87,11 @@
} }
/* Sidebar toggle unread badge */ /* Sidebar toggle unread badge */
.action-item.sidebar-toggle-action { .agent-sessions-workbench .action-item.sidebar-toggle-action {
position: relative; position: relative;
} }
.action-item.sidebar-toggle-action .sidebar-toggle-badge { .agent-sessions-workbench .action-item.sidebar-toggle-action .sidebar-toggle-badge {
position: absolute; position: absolute;
top: 0; top: 0;
right: -4px; right: -4px;

View File

@@ -306,7 +306,18 @@ class SidebarToggleActionViewItem extends ActionViewItem {
this._countBadge = append(container, $('span.sidebar-toggle-badge')); this._countBadge = append(container, $('span.sidebar-toggle-badge'));
this._updateBadge(); this._updateBadge();
// Update badge when sessions change // Subscribe to observable session state (status, isRead, isArchived)
// so the badge updates when any session's state changes
this._register(autorun(reader => {
for (const session of this.sessionsManagementService.getSessions()) {
session.isArchived.read(reader);
session.status.read(reader);
session.isRead.read(reader);
}
this._updateBadge();
}));
// Also update when sessions are added/removed
this._register(this.sessionsManagementService.onDidChangeSessions(() => this._updateBadge())); this._register(this.sessionsManagementService.onDidChangeSessions(() => this._updateBadge()));
// Update badge when sidebar visibility changes // Update badge when sidebar visibility changes