Skip to content

Commit c450955

Browse files
authored
Merge pull request #181 from sourcery-ai/ben/sou-1459-feat-improve-the-look-of-error-messages-and-include-icon
feat: add styles and icons for an error message
2 parents eab72c2 + 0b859a3 commit c450955

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

media/chat.css

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@
7474
.sidebar__chat-assistant--code-block-container {
7575
background-color: var(--vscode-settings-textInputBackground);
7676
padding: var(--spacing-xs);
77-
border-radius: var(--spacing-xs);
7877
flex-grow: 1;
7978
flex-shrink: 1;
8079
overflow: hidden;
80+
border-radius: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) 0;
8181
}
8282

8383
.sidebar__chat-assistant--chat-bubble-content-user {
8484
background-color: var(--vscode-settings-textInputBackground);
8585
padding: var(--spacing-xs);
86-
border-radius: var(--spacing-xs);
86+
border-radius: var(--spacing-sm) var(--spacing-sm) 0 var(--spacing-sm);
8787
}
8888

8989
.sidebar__chat-assistant--chat-bubble-content-user
@@ -136,9 +136,10 @@
136136
margin: 0;
137137
width: 100%;
138138
background-color: var(--vscode-editor-background);
139-
border: 1px solid var(--vscode-panel-border);
139+
outline: 1px solid var(--vscode-panel-border);
140140
border-radius: var(--spacing-xs);
141141
position: relative;
142+
overflow: hidden;
142143
}
143144

144145
button.sidebar__chat-assistant--chat-bubble-text--code-copy-button {
@@ -222,17 +223,6 @@ button.sidebar__chat-assistant--chat-bubble-text--code-copy-button:hover {
222223
text-decoration: none;
223224
}
224225

225-
/* Don't round the specific corner where the avatar is, to make it look more like a chat bubble */
226-
.sidebar__chat-assistant--chat-bubble-agent
227-
.sidebar__chat-assistant--chat-bubble-content {
228-
border-bottom-left-radius: 0;
229-
}
230-
231-
.sidebar__chat-assistant--chat-bubble-user
232-
.sidebar__chat-assistant--chat-bubble-content {
233-
border-bottom-right-radius: 0;
234-
}
235-
236226
/* Make avatar bigger for user, since we're using an emoji for now */
237227
.sidebar__chat-assistant--chat-bubble-user
238228
.sidebar__chat-assistant--agent-avatar-image {
@@ -248,16 +238,16 @@ button.sidebar__chat-assistant--chat-bubble-text--code-copy-button:hover {
248238

249239
.sidebar__chat-assistant--chat-bubble-error
250240
.sidebar__chat-assistant--chat-bubble-text {
251-
color: var(--vscode-inputValidation-errorForeground);
241+
color: var(--vscode-foreground);
252242
}
253243

254244
.sidebar__chat-assistant--chat-bubble-error
255245
.sidebar__chat-assistant--chat-avatar-container {
256246
background: var(--vscode-inputValidation-errorBackground);
257247
}
258248

259-
.sidebar__chat-assistant--chat-bubble-error svg {
260-
fill: var(--vscode-sideBar-foreground);
249+
.sidebar__chat-assistant--chat-bubble-error {
250+
fill: var(--vscode-foreground);
261251
}
262252

263253
.sidebar__chat-assistant--cursor {

src/webview/chat.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ const chatAvatar = `<div class="sidebar__chat-assistant--chat-avatar-container">
99
<span class="sidebar__chat-assistant--agent-avatar-image">🧙🏻‍♂️</span>
1010
</div>`;
1111

12+
const errorAvatar = `<div class="sidebar__chat-assistant--chat-avatar-container" >
13+
<svg xmlns="http://www.w3.org/2000/svg" height="1.25rem" viewBox="0 0 64 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 64c0-17.7-14.3-32-32-32S0 46.3 0 64V320c0 17.7 14.3 32 32 32s32-14.3 32-32V64zM32 480a40 40 0 1 0 0-80 40 40 0 1 0 0 80z"/></svg>
14+
</div>`;
15+
1216
// This is a little larger than the (empirical) number of pixels the window might scroll by when
1317
// a new line is added. If the line is less than this, we should try to keep scrolling with the window.
1418
// See `stickyScrollToBottom` below.
@@ -198,7 +202,7 @@ const LINE_HEIGHT = 36;
198202
} else {
199203
const templateContents = `
200204
<!-- Using an absolute sourcery.ai URL for now, since I'm not sure how does VS Code extensions handle static assets. -->
201-
${assistantAvatar}
205+
${message.outcome === "error" ? errorAvatar : assistantAvatar}
202206
<div class="sidebar__chat-assistant--chat-bubble-content-assistant">
203207
<p class="sidebar__chat-assistant--chat-bubble-text"></p>
204208
</div>`;

0 commit comments

Comments
 (0)