Skip to content

Commit ce9a665

Browse files
authored
Add home button to customizations editor sidebar (#308919)
An Overview button with a home icon sits in the header row alongside the harness picker. When the harness picker is visible, the button shows only the icon; when hidden (single harness), it expands to a full-width button with label.
1 parent 6df6bbd commit ce9a665

File tree

2 files changed

+91
-10
lines changed

2 files changed

+91
-10
lines changed

src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.ts

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ export class AICustomizationManagementEditor extends EditorPane {
318318
private harnessDropdownButton: HTMLElement | undefined;
319319
private harnessDropdownIcon: HTMLElement | undefined;
320320
private harnessDropdownLabel: HTMLElement | undefined;
321-
private sidebarContent: HTMLElement | undefined;
321+
private sidebarHeaderContainer: HTMLElement | undefined;
322+
private homeButton: HTMLElement | undefined;
323+
private homeButtonLabel: HTMLElement | undefined;
322324

323325
private readonly inEditorContextKey: IContextKey<boolean>;
324326
private readonly sectionContextKey: IContextKey<string>;
@@ -527,10 +529,10 @@ export class AICustomizationManagementEditor extends EditorPane {
527529
}
528530

529531
private createSidebar(): void {
530-
const sidebarContent = this.sidebarContent = DOM.append(this.sidebarContainer, $('.sidebar-content'));
532+
const sidebarContent = DOM.append(this.sidebarContainer, $('.sidebar-content'));
531533

532-
// Harness dropdown (shown when multiple harnesses available)
533-
this.createHarnessDropdown(sidebarContent);
534+
// Header row with home button and optional harness dropdown
535+
this.createSidebarHeader(sidebarContent);
534536

535537
// Main sections list container (takes remaining space)
536538
const sectionsListContainer = DOM.append(sidebarContent, $('.sidebar-sections-list'));
@@ -619,12 +621,32 @@ export class AICustomizationManagementEditor extends EditorPane {
619621
}
620622
}
621623

622-
private createHarnessDropdown(sidebarContent: HTMLElement): void {
624+
private createSidebarHeader(sidebarContent: HTMLElement): void {
625+
const headerRow = this.sidebarHeaderContainer = DOM.append(sidebarContent, $('.sidebar-header-row'));
626+
627+
// Home/overview button
628+
const homeButton = this.homeButton = DOM.append(headerRow, $('button.sidebar-home-button'));
629+
homeButton.setAttribute('aria-label', localize('homeButton', "Overview"));
630+
const homeIcon = DOM.append(homeButton, $('span.sidebar-home-icon'));
631+
homeIcon.classList.add(...ThemeIcon.asClassNameArray(Codicon.home));
632+
homeIcon.setAttribute('aria-hidden', 'true');
633+
const homeLabel = this.homeButtonLabel = DOM.append(homeButton, $('span.sidebar-home-label'));
634+
homeLabel.textContent = localize('overview', "Overview");
635+
this.editorDisposables.add(DOM.addDisposableListener(homeButton, 'click', () => {
636+
this.showWelcomePage();
637+
}));
638+
639+
// Harness dropdown (shown when multiple harnesses available)
640+
this.createHarnessDropdown(headerRow);
641+
this.updateHomeButtonStyle();
642+
}
643+
644+
private createHarnessDropdown(parent: HTMLElement): void {
623645
if (!this.isHarnessSelectorEnabled) {
624646
return;
625647
}
626648

627-
const container = this.harnessDropdownContainer = DOM.append(sidebarContent, $('.sidebar-harness-dropdown'));
649+
const container = this.harnessDropdownContainer = DOM.append(parent, $('.sidebar-harness-dropdown'));
628650

629651
this.harnessDropdownButton = DOM.append(container, $('button.harness-dropdown-button'));
630652
this.harnessDropdownButton.setAttribute('aria-label', localize('selectHarness', "Select customization target"));
@@ -659,19 +681,32 @@ export class AICustomizationManagementEditor extends EditorPane {
659681
this.harnessDropdownButton = undefined;
660682
this.harnessDropdownIcon = undefined;
661683
this.harnessDropdownLabel = undefined;
662-
} else if (this.isHarnessSelectorEnabled && !this.harnessDropdownContainer && this.sidebarContent) {
663-
this.createHarnessDropdown(this.sidebarContent);
684+
this.updateHomeButtonStyle();
685+
} else if (this.isHarnessSelectorEnabled && !this.harnessDropdownContainer && this.sidebarHeaderContainer) {
686+
this.createHarnessDropdown(this.sidebarHeaderContainer);
687+
this.updateHomeButtonStyle();
664688
}
665689
// Visibility is handled by updateHarnessDropdown based on harness count
666690
}
667691

692+
private updateHomeButtonStyle(): void {
693+
if (!this.homeButtonLabel || !this.homeButton) {
694+
return;
695+
}
696+
// Show full label when harness dropdown is hidden, icon-only when visible
697+
const harnessVisible = this.harnessDropdownContainer && this.harnessDropdownContainer.style.display !== 'none';
698+
this.homeButtonLabel.style.display = harnessVisible ? 'none' : '';
699+
this.homeButton.style.flex = harnessVisible ? '' : '1';
700+
}
701+
668702
private updateHarnessDropdown(): void {
669703
if (!this.harnessDropdownContainer || !this.harnessDropdownIcon || !this.harnessDropdownLabel) {
670704
return;
671705
}
672706
const harnesses = this.harnessService.availableHarnesses.get();
673707
// Hide dropdown when only one harness is available
674708
this.harnessDropdownContainer.style.display = harnesses.length <= 1 ? 'none' : '';
709+
this.updateHomeButtonStyle();
675710

676711
const activeId = this.harnessService.activeHarness.get();
677712
const descriptor = harnesses.find(h => h.id === activeId);

src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,52 @@
2626
flex-direction: column;
2727
}
2828

29+
.ai-customization-management-editor .sidebar-header-row {
30+
flex-shrink: 0;
31+
display: flex;
32+
align-items: center;
33+
gap: 4px;
34+
padding: 6px 4px 4px;
35+
}
36+
37+
.ai-customization-management-editor .sidebar-home-button {
38+
flex-shrink: 0;
39+
display: flex;
40+
align-items: center;
41+
gap: 8px;
42+
padding: 5px 8px;
43+
border: 1px solid var(--vscode-dropdown-border, transparent);
44+
border-radius: 4px;
45+
background: var(--vscode-dropdown-background);
46+
color: var(--vscode-dropdown-foreground);
47+
cursor: pointer;
48+
font-size: 12px;
49+
font-weight: 600;
50+
line-height: 18px;
51+
font-family: inherit;
52+
}
53+
54+
.ai-customization-management-editor .sidebar-home-button:hover {
55+
border-color: var(--vscode-focusBorder);
56+
}
57+
58+
.ai-customization-management-editor .sidebar-home-button:focus-visible {
59+
outline: 1px solid var(--vscode-focusBorder);
60+
outline-offset: -1px;
61+
}
62+
63+
.ai-customization-management-editor .sidebar-home-icon {
64+
flex-shrink: 0;
65+
font-size: 14px;
66+
opacity: 0.85;
67+
}
68+
69+
.ai-customization-management-editor .sidebar-home-label {
70+
overflow: hidden;
71+
text-overflow: ellipsis;
72+
white-space: nowrap;
73+
}
74+
2975
.ai-customization-management-editor .sidebar-sections-list {
3076
flex: 1;
3177
overflow: hidden;
@@ -173,8 +219,8 @@
173219

174220
/* Harness dropdown in sidebar */
175221
.ai-customization-management-editor .sidebar-harness-dropdown {
176-
flex-shrink: 0;
177-
padding: 6px 4px 4px;
222+
flex: 1;
223+
min-width: 0;
178224
}
179225

180226
.ai-customization-management-editor .harness-dropdown-button {

0 commit comments

Comments
 (0)