Skip to content

Commit

Permalink
chat - tweaks to welcome (#234343)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored Nov 21, 2024
1 parent ec8a019 commit 268d4cf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 26 deletions.
10 changes: 6 additions & 4 deletions src/vs/workbench/contrib/chat/browser/chatSetup.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,27 @@ class ChatSetupContribution extends Disposable implements IWorkbenchContribution
ChatContextKeys.Setup.installed.negate()
)!,
icon: defaultChat.icon,
progress: localize('setupChatSigningIn', "Signing in to {0}...", defaultChat.providerName),
disableFirstLinkToButton: true,
content: new MarkdownString([
header,
localize('setupChatSigningIn', "$(loading~spin) Signing in to {0}...", defaultChat.providerName),
footer,
`[${localize('learnMore', "Learn More")}](${defaultChat.documentationUrl})`,
].join('\n\n'), { isTrusted: true }),
].join('\n\n'), { isTrusted: true, supportThemeIcons: true }),
});

// Setup: Installing
Registry.as<IChatViewsWelcomeContributionRegistry>(ChatViewsWelcomeExtensions.ChatViewsWelcomeRegistry).register({
title: defaultChat.chatWelcomeTitle,
when: ChatContextKeys.Setup.installing,
icon: defaultChat.icon,
progress: localize('setupChatInstalling', "Setting up Chat for you..."),
disableFirstLinkToButton: true,
content: new MarkdownString([
header,
localize('setupChatInstalling', "$(loading~spin) Setting up Chat for you..."),
footer,
`[${localize('learnMore', "Learn More")}](${defaultChat.documentationUrl})`,
].join('\n\n'), { isTrusted: true }),
].join('\n\n'), { isTrusted: true, supportThemeIcons: true }),
});
}

Expand Down
15 changes: 6 additions & 9 deletions src/vs/workbench/contrib/chat/browser/media/chatViewWelcome.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ div.chat-welcome-view {
font-size: 11px;
}

& > .chat-welcome-view-progress {
display: flex;
gap: 6px;
text-align: center;
max-width: 350px;
padding: 0 20px;
margin-top: 20px;
}

& > .chat-welcome-view-message {
text-align: center;
max-width: 350px;
Expand All @@ -77,6 +68,12 @@ div.chat-welcome-view {
a {
color: var(--vscode-textLink-foreground);
}

.codicon[class*='codicon-'] {
font-size: 13px;
line-height: 1.4em;
vertical-align: bottom;
}
}

.monaco-button {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { IInstantiationService } from '../../../../../platform/instantiation/com
import { ILogService } from '../../../../../platform/log/common/log.js';
import { IOpenerService } from '../../../../../platform/opener/common/opener.js';
import { defaultButtonStyles } from '../../../../../platform/theme/browser/defaultStyles.js';
import { spinningLoading } from '../../../../../platform/theme/common/iconRegistry.js';
import { ChatAgentLocation } from '../../common/chatAgents.js';
import { chatViewsWelcomeRegistry, IChatViewsWelcomeDescriptor } from './chatViewsWelcome.js';

Expand Down Expand Up @@ -89,7 +88,7 @@ export class ChatViewWelcomeController extends Disposable {
icon: enabledDescriptor.icon,
title: enabledDescriptor.title,
message: enabledDescriptor.content,
progress: enabledDescriptor.progress
disableFirstLinkToButton: enabledDescriptor.disableFirstLinkToButton,
};
const welcomeView = this.renderDisposables.add(this.instantiationService.createInstance(ChatViewWelcomePart, content, { firstLinkToButton: true, location: this.location }));
this.element!.appendChild(welcomeView.element);
Expand All @@ -104,7 +103,7 @@ export interface IChatViewWelcomeContent {
icon?: ThemeIcon;
title: string;
message: IMarkdownString;
progress?: string;
disableFirstLinkToButton?: boolean;
tips?: IMarkdownString;
}

Expand Down Expand Up @@ -144,7 +143,7 @@ export class ChatViewWelcomePart extends Disposable {
title.textContent = content.title;
const renderer = this.instantiationService.createInstance(MarkdownRenderer, {});
const messageResult = this._register(renderer.render(content.message));
const firstLink = (options?.firstLinkToButton && !content.progress) ? messageResult.element.querySelector('a') : undefined;
const firstLink = options?.firstLinkToButton && !content.disableFirstLinkToButton ? messageResult.element.querySelector('a') : undefined;
if (firstLink) {
const target = firstLink.getAttribute('data-href');
const button = this._register(new Button(firstLink.parentElement!, defaultButtonStyles));
Expand All @@ -159,14 +158,6 @@ export class ChatViewWelcomePart extends Disposable {

dom.append(message, messageResult.element);

if (content.progress) {
const progress = dom.append(this.element, $('.chat-welcome-view-progress'));
progress.appendChild(renderIcon(spinningLoading));

const progressLabel = dom.append(progress, $('span'));
progressLabel.textContent = content.progress;
}

if (content.tips) {
const tips = dom.append(this.element, $('.chat-welcome-view-tips'));
const tipsResult = this._register(renderer.render(content.tips));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface IChatViewsWelcomeDescriptor {
icon?: ThemeIcon;
title: string;
content: IMarkdownString;
progress?: string;
disableFirstLinkToButton?: boolean;
when: ContextKeyExpression;
}

Expand Down

0 comments on commit 268d4cf

Please sign in to comment.