Skip to content

Commit f3118e0

Browse files
committed
Refactor UI styles to use consistent theme variables and add breathing animations for visual feedback
1 parent ee56310 commit f3118e0

6 files changed

Lines changed: 145 additions & 171 deletions

File tree

‎packages/ui/src/components/editor/panel/ResponsePreview/ResponsePreview.module.scss‎

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,19 @@
1717

1818
&--error {
1919
color: var(--vscode-gitDecoration-deletedResourceForeground);
20-
background-color: color-mix(
21-
in srgb,
22-
var(--vscode-gitDecoration-deletedResourceForeground) 12%,
23-
transparent
24-
);
20+
background-color: var(--cwc-bg-error);
2521

2622
.info__action:hover {
27-
background-color: color-mix(
28-
in srgb,
29-
var(--vscode-gitDecoration-deletedResourceForeground) 12%,
30-
transparent
31-
);
23+
background-color: var(--cwc-bg-error);
3224
}
3325
}
3426

3527
&--warning {
3628
color: var(--vscode-gitDecoration-modifiedResourceForeground);
37-
background-color: color-mix(
38-
in srgb,
39-
var(--vscode-gitDecoration-modifiedResourceForeground) 12%,
40-
transparent
41-
);
29+
background-color: var(--cwc-bg-warning);
4230

4331
.info__action:hover {
44-
background-color: color-mix(
45-
in srgb,
46-
var(--vscode-gitDecoration-modifiedResourceForeground) 12%,
47-
transparent
48-
);
32+
background-color: var(--cwc-bg-warning);
4933
}
5034
}
5135

@@ -112,7 +96,15 @@
11296
margin: 0 12px;
11397
padding: 7px 9px 9px 9px;
11498
border-radius: 6px;
115-
background: var(--cwc-bg-tertiary);
99+
background-color: var(--cwc-bg-tertiary);
100+
background-image: linear-gradient(
101+
to right,
102+
var(--cwc-bg-secondary),
103+
var(--cwc-bg-secondary)
104+
);
105+
background-repeat: no-repeat;
106+
background-size: 0% 100%;
107+
animation: breathe 10s infinite linear;
116108

117109
&__item {
118110
display: flex;
@@ -149,7 +141,7 @@
149141

150142
&__bar {
151143
height: 2px;
152-
background-color: var(--vscode-dropdown-border);
144+
background-color: var(--cwc-bg-secondary);
153145
width: 100%;
154146
border-radius: 2px;
155147
overflow: hidden;
@@ -170,3 +162,15 @@
170162
margin-top: 0;
171163
}
172164
}
165+
166+
@keyframes breathe {
167+
0% {
168+
background-size: 0% 100%;
169+
}
170+
50% {
171+
background-size: 100% 100%;
172+
}
173+
100% {
174+
background-size: 0% 100%;
175+
}
176+
}

‎packages/ui/src/components/editor/panel/ResponsePreview/components/FileItem/FileItem.module.scss‎

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -122,58 +122,38 @@
122122

123123
&--error {
124124
color: var(--vscode-gitDecoration-deletedResourceForeground);
125-
background-color: color-mix(
126-
in srgb,
127-
var(--vscode-gitDecoration-deletedResourceForeground) 12%,
128-
transparent
129-
);
125+
background-color: var(--cwc-bg-error);
130126

131127
.message__actions__item:hover {
132-
background-color: color-mix(
133-
in srgb,
134-
var(--vscode-gitDecoration-deletedResourceForeground) 12%,
135-
transparent
136-
);
128+
background-color: var(--cwc-bg-error);
137129
}
138130
}
139131

140132
&--warning {
141133
color: var(--vscode-gitDecoration-modifiedResourceForeground);
142-
background-color: color-mix(
143-
in srgb,
144-
var(--vscode-gitDecoration-modifiedResourceForeground) 12%,
145-
transparent
146-
);
134+
background-color: var(--cwc-bg-warning);
147135

148136
.message__actions__item:hover {
149-
background-color: color-mix(
150-
in srgb,
151-
var(--vscode-gitDecoration-modifiedResourceForeground) 12%,
152-
transparent
153-
);
137+
background-color: var(--cwc-bg-warning);
154138
}
155139
}
156140

157141
&--success {
158142
color: var(--vscode-gitDecoration-addedResourceForeground);
159-
background-color: color-mix(
160-
in srgb,
161-
var(--vscode-gitDecoration-addedResourceForeground) 12%,
162-
transparent
163-
);
143+
background-color: var(--cwc-bg-success);
164144

165145
.message__actions__item:hover {
166-
background-color: color-mix(
167-
in srgb,
168-
var(--vscode-gitDecoration-addedResourceForeground) 12%,
169-
transparent
170-
);
146+
background-color: var(--cwc-bg-success);
171147
}
172148
}
173149

174150
&--loading {
175151
color: var(--cwc-text-color);
176152
background-color: var(--cwc-bg-tertiary);
153+
154+
.message__actions__item:hover {
155+
background-color: var(--cwc-bg-secondary);
156+
}
177157
}
178158

179159
&__content {

‎packages/ui/src/components/editor/panel/ResponsePreview/components/FileItem/FileItem.tsx‎

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,38 @@ type Props = {
2020
}
2121

2222
type FileMessage =
23-
| { type: 'success'; text: string; show_actions?: boolean }
24-
| { type: 'error'; text: string; show_actions: boolean }
25-
| { type: 'warning'; text: string; show_actions: boolean }
26-
| { type: 'loading'; text: string; show_actions?: boolean }
23+
| { type: 'success'; text: string }
24+
| { type: 'error'; text: string }
25+
| { type: 'warning'; text: string }
26+
| { type: 'loading'; text: string }
2727

2828
const get_file_message = (file: FileInPreview): FileMessage | null => {
2929
if (file.is_applying) {
30+
let text = 'Applying...'
31+
if (file.apply_status == 'waiting') text = 'Waiting...'
32+
else if (file.apply_status == 'thinking') text = 'Thinking...'
33+
else if (file.apply_status == 'retrying') text = 'Retrying...'
34+
else if (file.apply_status == 'receiving') text = 'Receiving...'
35+
else if (file.apply_status == 'done') text = 'Done'
36+
3037
return {
3138
type: 'loading',
32-
text: 'Applying...',
33-
show_actions: false
39+
text
3440
}
3541
} else if (file.applied_with_intelligent_update) {
3642
return {
3743
type: 'success',
38-
text: 'Applied with Intelligent Update',
39-
show_actions: true
44+
text: 'Applied with Intelligent Update'
4045
}
4146
} else if (file.apply_failed) {
4247
return {
4348
type: 'error',
44-
text: 'Failed to apply changes',
45-
show_actions: true
49+
text: 'Failed to apply changes'
4650
}
4751
} else if (file.diff_application_method == 'search_and_replace') {
4852
return {
4953
type: 'warning',
50-
text: 'Used aggressive fallback method',
51-
show_actions: true
54+
text: 'Used aggressive fallback method'
5255
}
5356
} else {
5457
return null
@@ -82,17 +85,14 @@ export const FileItem: FC<Props> = (props) => {
8285
if (!props.file.is_applying) return null
8386

8487
let status_text = ''
85-
if (props.file.apply_status == 'waiting') status_text = 'Waiting...'
86-
else if (props.file.apply_status == 'thinking') status_text = 'Thinking...'
87-
else if (props.file.apply_status == 'retrying') status_text = 'Retrying...'
88-
else if (props.file.apply_status == 'receiving') {
88+
if (props.file.apply_status == 'receiving') {
8989
const tps = props.file.apply_tokens_per_second
9090
if (tps) status_text = `${tps} tokens/s`
91-
} else if (props.file.apply_status == 'done') status_text = 'Done'
91+
}
9292

9393
return (
9494
<div className={styles.progress}>
95-
<span>{status_text}</span>
95+
{status_text && <span>{status_text}</span>}
9696
<span>{elapsed_seconds.toFixed(1)}s</span>
9797
{props.file.apply_status != 'done' && (
9898
<div
@@ -250,38 +250,34 @@ export const FileItem: FC<Props> = (props) => {
250250
)}
251251
<span>{message_obj.text}</span>
252252
</div>
253-
{'show_actions' in message_obj && message_obj.show_actions && (
254-
<div className={styles['message__actions']}>
255-
{props.file.ai_content && (
256-
<div
257-
className={styles['message__actions__item']}
258-
onClick={props.on_preview_generated_code}
259-
title="Preview generated code"
260-
>
261-
<span className="codicon codicon-open-preview" />
262-
<span>Preview</span>
263-
</div>
264-
)}
265-
{!props.file.is_applying && (
266-
<div
267-
className={styles['message__actions__item']}
268-
onClick={() =>
269-
props.on_intelligent_update(
270-
!!props.file.applied_with_intelligent_update
271-
)
272-
}
273-
title="Apply with Intelligent Update API tool"
274-
>
275-
<span className="codicon codicon-sparkle" />
276-
<span>
277-
{props.file.applied_with_intelligent_update
278-
? 'Retry'
279-
: 'Fix'}
280-
</span>
281-
</div>
282-
)}
283-
</div>
284-
)}
253+
<div className={styles['message__actions']}>
254+
{props.file.ai_content && (
255+
<div
256+
className={styles['message__actions__item']}
257+
onClick={props.on_preview_generated_code}
258+
title="Preview generated code"
259+
>
260+
<span className="codicon codicon-open-preview" />
261+
<span>Preview</span>
262+
</div>
263+
)}
264+
{!props.file.is_applying && (
265+
<div
266+
className={styles['message__actions__item']}
267+
onClick={() =>
268+
props.on_intelligent_update(
269+
!!props.file.applied_with_intelligent_update
270+
)
271+
}
272+
title="Apply with Intelligent Update API tool"
273+
>
274+
<span className="codicon codicon-sparkle" />
275+
<span>
276+
{props.file.applied_with_intelligent_update ? 'Retry' : 'Fix'}
277+
</span>
278+
</div>
279+
)}
280+
</div>
285281
</div>
286282
)}
287283
</div>

0 commit comments

Comments
 (0)