Skip to content

Commit 5869829

Browse files
committed
Enhance the ProgressModal component to display detailed file path information and accurate progress indicators for individual files
1 parent 90ca65b commit 5869829

6 files changed

Lines changed: 79 additions & 229 deletions

File tree

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

Lines changed: 0 additions & 61 deletions
This file was deleted.

‎packages/ui/src/components/editor/panel/Switch/Switch.stories.tsx‎

Lines changed: 0 additions & 45 deletions
This file was deleted.

‎packages/ui/src/components/editor/panel/Switch/Switch.tsx‎

Lines changed: 0 additions & 62 deletions
This file was deleted.

‎packages/ui/src/components/editor/panel/Switch/index.ts‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎packages/ui/src/components/editor/panel/modals/ProgressModal/ProgressModal.module.scss‎

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
background-color: var(--vscode-focusBorder);
2727
transition: width var(--transition-duration-150)
2828
var(--transition-timing-function);
29-
}
3029

31-
&__fill--indeterminate {
32-
height: 100%;
33-
background-color: var(--vscode-focusBorder);
34-
position: absolute;
35-
animation: indeterminate-progress 1.5s infinite linear;
30+
&--indeterminate {
31+
height: 100%;
32+
background-color: var(--vscode-focusBorder);
33+
position: absolute;
34+
animation: indeterminate-progress 1.5s infinite linear;
35+
}
3636
}
3737
}
3838

@@ -46,11 +46,6 @@
4646
display: flex;
4747
flex-direction: column;
4848
gap: var(--padding-8px);
49-
max-height: 200px;
50-
overflow-y: auto;
51-
padding: var(--padding-4px);
52-
background-color: var(--vscode-input-background);
53-
border-radius: var(--border-radius-4px);
5449
}
5550

5651
.file-item {
@@ -67,18 +62,22 @@
6762
}
6863

6964
.file-item__name {
70-
font-family: monospace;
7165
font-size: 12px;
7266
white-space: nowrap;
7367
overflow: hidden;
7468
text-overflow: ellipsis;
7569
color: var(--vscode-descriptionForeground);
7670
flex-shrink: 1;
71+
72+
> span:nth-child(2) {
73+
margin-left: 0.5em;
74+
opacity: 0.7;
75+
font-size: 0.9em;
76+
}
7777
}
7878

7979
.file-item__status {
8080
font-size: 12px;
81-
font-weight: bold;
8281
flex-shrink: 0;
8382

8483
&--waiting {
@@ -100,7 +99,7 @@
10099

101100
.file-item__details {
102101
font-family: monospace;
103-
font-size: 11px;
102+
font-size: 10px;
104103
color: var(--vscode-descriptionForeground);
105104
text-align: right;
106105
}

‎packages/ui/src/components/editor/panel/modals/ProgressModal/ProgressModal.tsx‎

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -71,46 +71,71 @@ export const ProgressModal: React.FC<Props> = (props) => {
7171

7272
{props.files ? (
7373
<div className={styles['files-container']}>
74-
{props.files.map((file) => (
75-
<div key={file.file_path} className={styles['file-item']}>
76-
<div className={styles['file-item__header']}>
77-
<div className={styles['file-item__name']}>
78-
{file.file_path}
79-
</div>
80-
<div
81-
className={cn(
82-
styles['file-item__status'],
83-
styles[`file-item__status--${file.status}`]
84-
)}
85-
>
86-
{get_status_text(file.status)}
74+
{props.files.map((file) => {
75+
const last_slash_index = file.file_path.lastIndexOf('/')
76+
const file_name =
77+
last_slash_index === -1
78+
? file.file_path
79+
: file.file_path.substring(last_slash_index + 1)
80+
const directory_path =
81+
last_slash_index === -1
82+
? ''
83+
: file.file_path.substring(0, last_slash_index)
84+
85+
return (
86+
<div key={file.file_path} className={styles['file-item']}>
87+
<div className={styles['file-item__header']}>
88+
<div className={styles['file-item__name']}>
89+
<span>{file_name}</span>
90+
<span>{directory_path}</span>
91+
</div>
92+
<div
93+
className={cn(
94+
styles['file-item__status'],
95+
styles[`file-item__status--${file.status}`]
96+
)}
97+
>
98+
{get_status_text(file.status)}
99+
</div>
87100
</div>
88-
</div>
89-
{(file.status === 'receiving' ||
90-
file.status === 'thinking') && (
91101
<div className={styles.progress}>
92-
{file.status === 'receiving' &&
93-
file.progress !== undefined ? (
102+
{file.status === 'thinking' ||
103+
(file.status === 'receiving' &&
104+
file.progress === undefined) ? (
94105
<div
95-
className={styles.progress__fill}
96-
style={{ width: `${file.progress}%` }}
106+
className={styles['progress__fill--indeterminate']}
97107
/>
98108
) : (
99109
<div
100-
className={styles['progress__fill--indeterminate']}
110+
className={cn(styles.progress__fill, {
111+
[styles['progress__fill--done']]:
112+
file.status === 'done',
113+
[styles['progress__fill--error']]:
114+
file.status === 'error'
115+
})}
116+
style={{
117+
width: `${
118+
file.status === 'done' || file.status === 'error'
119+
? 100
120+
: file.status === 'receiving' &&
121+
file.progress !== undefined
122+
? file.progress
123+
: 0
124+
}%`
125+
}}
101126
/>
102127
)}
103128
</div>
104-
)}
105-
{file.status === 'receiving' &&
106-
file.tokens_per_second !== undefined && (
107-
<div className={styles['file-item__details']}>
108-
~{format_tokens_per_second(file.tokens_per_second)}{' '}
109-
tokens/s
110-
</div>
111-
)}
112-
</div>
113-
))}
129+
{file.status === 'receiving' &&
130+
file.tokens_per_second !== undefined && (
131+
<div className={styles['file-item__details']}>
132+
~{format_tokens_per_second(file.tokens_per_second)}{' '}
133+
tokens/s
134+
</div>
135+
)}
136+
</div>
137+
)
138+
})}
114139
</div>
115140
) : (
116141
<>
@@ -119,19 +144,16 @@ export const ProgressModal: React.FC<Props> = (props) => {
119144
~{format_tokens_per_second(props.tokens_per_second)} tokens/s
120145
</div>
121146
)}
122-
{(props.progress !== undefined ||
123-
props.tokens_per_second !== undefined) && (
124-
<div className={styles.progress}>
125-
{props.progress !== undefined ? (
126-
<div
127-
className={styles.progress__fill}
128-
style={{ width: `${props.progress}%` }}
129-
/>
130-
) : (
131-
<div className={styles['progress__fill--indeterminate']} />
132-
)}
133-
</div>
134-
)}
147+
<div className={styles.progress}>
148+
{props.progress !== undefined ? (
149+
<div
150+
className={styles.progress__fill}
151+
style={{ width: `${props.progress}%` }}
152+
/>
153+
) : (
154+
<div className={styles['progress__fill--indeterminate']} />
155+
)}
156+
</div>
135157
</>
136158
)}
137159

0 commit comments

Comments
 (0)