File tree Expand file tree Collapse file tree
packages/ui/src/components/editor/panel/modals/StageFilesModal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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 = {
You can’t perform that action at this time.
0 commit comments