Skip to content

Commit 920a47d

Browse files
committed
update
1 parent 6df916d commit 920a47d

4 files changed

Lines changed: 29 additions & 20 deletions

File tree

src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsBanner.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,38 +39,42 @@ export function canShowAgentsBanner(productService: IProductService): boolean {
3939
&& !!CommandsRegistry.getCommand(OPEN_AGENTS_WINDOW_COMMAND);
4040
}
4141

42+
export interface IAgentsBannerOptions {
43+
/** Dot-separated CSS classes for the banner container (e.g. 'my-banner' or 'foo.bar'). */
44+
readonly cssClass: string;
45+
/** Identifies where the banner is displayed (e.g. 'welcomePage', 'agentSessionsWelcome'). */
46+
readonly source: string;
47+
/** Override the default button label. */
48+
readonly label?: string;
49+
/** Optional callback invoked when the banner button is clicked. */
50+
readonly onButtonClick?: () => void;
51+
}
52+
4253
/**
4354
* Creates a banner that promotes the Agents app.
4455
* The banner contains a button that opens the Agents window.
45-
*
46-
* @param cssClass Dot-separated CSS classes for the banner container (e.g. 'my-banner' or 'foo.bar').
47-
* @param source Identifies where the banner is displayed (e.g. 'welcomePage', 'agentSessionsWelcome').
48-
* @param commandService Used to execute the open command.
49-
* @param telemetryService Used to log banner interactions.
50-
* @param onButtonClick Optional callback invoked when the banner button is clicked.
5156
*/
5257
export function createAgentsBanner(
53-
cssClass: string,
54-
source: string,
58+
options: IAgentsBannerOptions,
5559
commandService: ICommandService,
5660
telemetryService: ITelemetryService,
57-
onButtonClick?: () => void,
5861
): IAgentsBannerResult {
5962
const disposables = new DisposableStore();
63+
const label = options.label ?? localize('agentsBanner.tryAgentsAppLabel', "Try out the new Agents app");
6064

6165
const button = $('button.agents-banner-button', {
62-
title: localize('agentsBanner.tryAgentsApp', "Try out the new Agents app"),
66+
title: label,
6367
},
6468
$('.codicon.codicon-agent.icon-widget'),
65-
$('span.category-title', {}, localize('agentsBanner.tryAgentsAppLabel', "Try out the new Agents app")),
69+
$('span.category-title', {}, label),
6670
);
6771
disposables.add(addDisposableListener(button, 'click', () => {
68-
onButtonClick?.();
69-
telemetryService.publicLog2<AgentsBannerClickedEvent, AgentsBannerClickedClassification>('agentsBanner.clicked', { source, action: 'openAgentsWindow' });
72+
options.onButtonClick?.();
73+
telemetryService.publicLog2<AgentsBannerClickedEvent, AgentsBannerClickedClassification>('agentsBanner.clicked', { source: options.source, action: 'openAgentsWindow' });
7074
commandService.executeCommand(OPEN_AGENTS_WINDOW_COMMAND, { forceNewWindow: true });
7175
}));
7276

73-
const element = $(`.${cssClass}`, {}, button);
77+
const element = $(`.${options.cssClass}`, {}, button);
7478

7579
return { element, disposables };
7680
}

src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcome.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,14 @@ export class AgentSessionsWelcomePage extends EditorPane {
597597
// "Try out the new Agents app" banner
598598
if (canShowAgentsBanner(this.productService)) {
599599
const agentsBanner = createAgentsBanner(
600-
'agentSessionsWelcome-agentsBanner',
601-
'agentSessionsWelcome',
600+
{
601+
cssClass: 'agentSessionsWelcome-agentsBanner',
602+
source: 'agentSessionsWelcome',
603+
label: localize('viewAllSessions', "View All Sessions"),
604+
onButtonClick: () => { this._closedBy = 'viewAllSessions'; },
605+
},
602606
this.commandService,
603607
this.telemetryService,
604-
() => { this._closedBy = 'viewAllSessions'; },
605608
);
606609
this.sessionsControlDisposables.add(agentsBanner.disposables);
607610
append(container, agentsBanner.element);

src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,10 @@ export class GettingStartedPage extends EditorPane {
935935
const footerChildren: HTMLElement[] = [];
936936
if (canShowAgentsBanner(this.productService)) {
937937
const agentsBanner = createAgentsBanner(
938-
'getting-started-category.agents-banner',
939-
'welcomePage',
938+
{
939+
cssClass: 'getting-started-category.agents-banner',
940+
source: 'welcomePage',
941+
},
940942
this.commandService,
941943
this.telemetryService,
942944
);

src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@
932932
cursor: pointer;
933933
font-family: inherit;
934934
font-size: 13px;
935-
margin-bottom: 10px;
935+
margin-bottom: 20px;
936936
}
937937

938938
.monaco-workbench .part.editor > .content .gettingStartedContainer .gettingStartedSlideCategories > .gettingStartedCategoriesContainer .index-list.start-container {

0 commit comments

Comments
 (0)