Skip to content

Commit df047bb

Browse files
committed
Hide token count when zero and refine SelectedFiles styles
- should not show 0
1 parent 3f3ccef commit df047bb

2 files changed

Lines changed: 22 additions & 15 deletions

File tree

‎packages/ui/src/components/editor/prompt/SelectedFiles/SelectedFiles.module.scss‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
.container {
2-
margin: 0 22px;
2+
--height: 24px;
33
display: flex;
44
justify-content: space-between;
55
border-bottom-left-radius: 6px;
66
border-bottom-right-radius: 6px;
7-
overflow: hidden;
87
color: var(--cwc-text-color);
98
background-color: var(--cwc-bg-tertiary);
10-
user-select: none;
11-
height: 28px;
9+
overflow: hidden;
10+
height: var(--height);
11+
margin: 0 22px;
1212

1313
:global([data-modern-ui='true']) & {
1414
margin: 0 20px;
@@ -20,7 +20,7 @@
2020
display: flex;
2121
align-items: center;
2222
overflow: hidden;
23-
padding-left: 7px;
23+
padding-left: 5px;
2424
min-width: 0;
2525

2626
&__label {
@@ -31,9 +31,9 @@
3131
cursor: pointer;
3232
height: 100%;
3333
display: block;
34-
line-height: 28px;
34+
line-height: var(--height);
3535
padding-left: 6px;
36-
padding-right: 4px;
36+
padding-right: 6px;
3737
}
3838
}
3939

@@ -61,9 +61,13 @@
6161
cursor: pointer;
6262
white-space: nowrap;
6363
color: var(--vscode-textLink-foreground);
64-
padding: 0 6px 0 6px;
64+
padding: 0 6px 0 5px;
6565
height: 100%;
6666

67+
> span:first-child::before {
68+
font-size: 15px;
69+
}
70+
6771
&:hover {
6872
background-color: var(--vscode-toolbar-hoverBackground);
6973
}

‎packages/ui/src/components/editor/prompt/SelectedFiles/SelectedFiles.tsx‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,16 @@ export const SelectedFiles: React.FC<SelectedFiles.Props> = (props) => {
3838
</label>
3939
</div>
4040
<div className={styles.actions}>
41-
<span
42-
className={cn(styles.count, {
43-
[styles['count--excluded']]: props.include_selected_files === false
44-
})}
45-
>
46-
{display_token_count(props.selected_files_token_count)}
47-
</span>
41+
{props.selected_files_token_count > 0 && (
42+
<span
43+
className={cn(styles.count, {
44+
[styles['count--excluded']]:
45+
props.include_selected_files === false
46+
})}
47+
>
48+
{display_token_count(props.selected_files_token_count)}
49+
</span>
50+
)}
4851
<div
4952
className={styles.preview}
5053
onClick={(e) => {

0 commit comments

Comments
 (0)