Skip to content

Commit 9013adb

Browse files
committed
Enhance the staging modal file list by separating and styling the filename and directory path for improved readability
1 parent d9ec4c0 commit 9013adb

2 files changed

Lines changed: 49 additions & 10 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@
99
gap: var(--padding-8px);
1010
cursor: pointer;
1111
font-size: var(--vscode-font-size);
12+
13+
&__details {
14+
display: flex;
15+
flex: 1;
16+
gap: var(--padding-6px);
17+
overflow: hidden;
18+
}
19+
20+
&__name {
21+
white-space: nowrap;
22+
}
23+
24+
&__path {
25+
white-space: nowrap;
26+
overflow: hidden;
27+
text-overflow: ellipsis;
28+
color: var(--vscode-descriptionForeground);
29+
}
1230
}
1331
}
1432

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

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,40 @@ export const StageFilesModal: React.FC<Props> = (props) => {
2727

2828
return (
2929
<Modal
30-
title="Select files"
30+
title="Select files to commit"
3131
content_max_height="30vh"
3232
content_slot={
3333
<div className={styles.files}>
34-
{props.files.map((file) => (
35-
<label key={file} className={styles.files__item}>
36-
<Checkbox
37-
checked={selected_files.includes(file)}
38-
on_change={(is_checked) => handle_toggle_file(file, is_checked)}
39-
/>
40-
<span>{file}</span>
41-
</label>
42-
))}
34+
{props.files.map((file) => {
35+
const last_slash_index = file.lastIndexOf('/')
36+
const filename =
37+
last_slash_index == -1
38+
? file
39+
: file.substring(last_slash_index + 1)
40+
const dir_path =
41+
last_slash_index == -1 ? '' : file.substring(0, last_slash_index)
42+
43+
return (
44+
<label key={file} className={styles.files__item}>
45+
<Checkbox
46+
checked={selected_files.includes(file)}
47+
on_change={(is_checked) =>
48+
handle_toggle_file(file, is_checked)
49+
}
50+
/>
51+
<div className={styles.files__item__details}>
52+
<span className={styles.files__item__name} title={filename}>
53+
{filename}
54+
</span>
55+
{dir_path && (
56+
<span className={styles.files__item__path} title={dir_path}>
57+
{dir_path}
58+
</span>
59+
)}
60+
</div>
61+
</label>
62+
)
63+
})}
4364
</div>
4465
}
4566
footer_slot={

0 commit comments

Comments
 (0)