@@ -117,34 +117,6 @@ function getContextPreviewTabID(activeTab: PreviewTab | undefined) {
117117 return activeTab . id
118118}
119119
120- function formatPreviewMeta ( tab : FilePreviewTab ) {
121- const segments : string [ ] = [ ]
122- if ( typeof tab . size === 'number' ) {
123- segments . push ( `${ tab . size } B` )
124- }
125- if ( tab . encoding ) {
126- segments . push ( tab . encoding )
127- }
128- if ( tab . mod_time ) {
129- segments . push ( tab . mod_time )
130- }
131- return segments . join ( ' · ' )
132- }
133-
134- function formatGitDiffMeta ( tab : GitDiffFilePreviewTab ) {
135- const segments : string [ ] = [ ]
136- if ( typeof tab . size_original === 'number' ) {
137- segments . push ( `原始 ${ tab . size_original } B` )
138- }
139- if ( typeof tab . size_modified === 'number' ) {
140- segments . push ( `当前 ${ tab . size_modified } B` )
141- }
142- if ( tab . encoding ) {
143- segments . push ( tab . encoding )
144- }
145- return segments . join ( ' · ' )
146- }
147-
148120function DiffLineView ( { line } : { line : DiffLine } ) {
149121 const lineStyles : Record < DiffLine [ 'type' ] , CSSProperties > = {
150122 add : { color : 'var(--diff-add-text)' , background : 'var(--diff-add-bg)' } ,
@@ -313,7 +285,6 @@ function PreviewFallback({ message = '正在加载代码编辑器...' }: { messa
313285
314286function FilePreviewView ( { tab } : { tab : FilePreviewTab } ) {
315287 const theme = useUIStore ( ( state ) => state . theme )
316- const meta = formatPreviewMeta ( tab )
317288
318289 let body = null
319290 if ( tab . loading ) {
@@ -336,10 +307,8 @@ function FilePreviewView({ tab }: { tab: FilePreviewTab }) {
336307
337308 return (
338309 < div style = { styles . viewContainer } >
339- < div style = { styles . viewHeader } >
340- < span style = { styles . viewTitle } > { tab . title } </ span >
341- < div style = { styles . previewPath } > { tab . path } </ div >
342- { meta && < div style = { styles . previewMeta } > { meta } </ div > }
310+ < div style = { styles . viewHeader } data-testid = "file-preview-header" >
311+ < div style = { styles . previewPath } data-testid = "file-preview-path" title = { tab . path } > { tab . path } </ div >
343312 </ div >
344313 { body }
345314 </ div >
@@ -349,8 +318,6 @@ function FilePreviewView({ tab }: { tab: FilePreviewTab }) {
349318function GitDiffFileView ( { tab } : { tab : GitDiffFilePreviewTab } ) {
350319 const theme = useUIStore ( ( state ) => state . theme )
351320 const changesPanelWidth = useUIStore ( ( state ) => state . changesPanelWidth )
352- const meta = formatGitDiffMeta ( tab )
353- const statusMeta = gitDiffStatusMeta [ tab . status ]
354321
355322 let body = null
356323 if ( tab . loading ) {
@@ -377,14 +344,8 @@ function GitDiffFileView({ tab }: { tab: GitDiffFilePreviewTab }) {
377344
378345 return (
379346 < div style = { styles . viewContainer } >
380- < div style = { styles . viewHeader } >
381- < div style = { styles . titleRow } >
382- < span style = { styles . viewTitle } > { tab . title } </ span >
383- < span style = { { ...styles . statusPill , color : statusMeta . color , background : statusMeta . bg } } > { statusMeta . label } </ span >
384- </ div >
385- < div style = { styles . previewPath } > { tab . path } </ div >
386- { tab . old_path && < div style = { styles . previewSubPath } > 原路径: { tab . old_path } </ div > }
387- { meta && < div style = { styles . previewMeta } > { meta } </ div > }
347+ < div style = { styles . viewHeader } data-testid = "git-diff-file-preview-header" >
348+ < div style = { styles . previewPath } data-testid = "git-diff-file-preview-path" title = { tab . path } > { tab . path } </ div >
388349 </ div >
389350 { body }
390351 </ div >
@@ -931,16 +892,21 @@ const styles: Record<string, CSSProperties> = {
931892 display : 'flex' ,
932893 flexDirection : 'column' ,
933894 overflow : 'hidden' ,
895+ padding : '8px 10px 0' ,
934896 } ,
935897 viewContainer : {
936898 display : 'flex' ,
937899 flexDirection : 'column' ,
938900 flex : 1 ,
939901 minHeight : 0 ,
940902 overflow : 'hidden' ,
903+ background : 'var(--bg-primary)' ,
904+ border : '1px solid var(--border-primary)' ,
905+ borderRadius : 'var(--radius-md)' ,
906+ boxShadow : 'var(--shadow-surface)' ,
941907 } ,
942908 viewHeader : {
943- padding : '12px 14px ' ,
909+ padding : '8px 10px ' ,
944910 borderBottom : '1px solid var(--border-primary)' ,
945911 flexShrink : 0 ,
946912 } ,
@@ -984,7 +950,7 @@ const styles: Record<string, CSSProperties> = {
984950 flex : 1 ,
985951 minHeight : 0 ,
986952 overflow : 'auto' ,
987- padding : 12 ,
953+ padding : 10 ,
988954 } ,
989955 contentStack : {
990956 display : 'flex' ,
@@ -1143,22 +1109,19 @@ const styles: Record<string, CSSProperties> = {
11431109 color : 'var(--text-tertiary)' ,
11441110 fontSize : 12 ,
11451111 fontFamily : 'var(--font-ui)' ,
1146- padding : 20 ,
1112+ padding : 16 ,
11471113 textAlign : 'center' ,
11481114 } ,
11491115 previewPath : {
1150- marginTop : 8 ,
1116+ marginTop : 0 ,
11511117 color : 'var(--text-secondary)' ,
11521118 fontSize : 12 ,
11531119 fontFamily : 'var(--font-ui)' ,
1154- wordBreak : 'break-all' ,
1155- } ,
1156- previewSubPath : {
1157- marginTop : 4 ,
1158- color : 'var(--text-tertiary)' ,
1159- fontSize : 11 ,
1160- fontFamily : 'var(--font-ui)' ,
1161- wordBreak : 'break-all' ,
1120+ minWidth : 0 ,
1121+ lineHeight : '18px' ,
1122+ whiteSpace : 'nowrap' ,
1123+ overflow : 'hidden' ,
1124+ textOverflow : 'ellipsis' ,
11621125 } ,
11631126 previewMeta : {
11641127 marginTop : 6 ,
0 commit comments