From c40cfb2cc2196a6b3a1b3a7c523211f856c6e4b3 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Sat, 4 Apr 2026 14:37:28 -0700 Subject: [PATCH] fix: improve file path display truncation (#297) * fix: tighten file path display rows * fix: extract file explorer background menu --- .../src/components/editor/DiffSectionItem.tsx | 8 +-- .../components/right-sidebar/FileExplorer.tsx | 41 ++++----------- .../FileExplorerBackgroundMenu.tsx | 50 +++++++++++++++++++ .../right-sidebar/SearchResultItems.tsx | 10 ++-- .../right-sidebar/SourceControl.tsx | 10 ++-- 5 files changed, 73 insertions(+), 46 deletions(-) create mode 100644 src/renderer/src/components/right-sidebar/FileExplorerBackgroundMenu.tsx diff --git a/src/renderer/src/components/editor/DiffSectionItem.tsx b/src/renderer/src/components/editor/DiffSectionItem.tsx index d39eacf77..8bd954669 100644 --- a/src/renderer/src/components/editor/DiffSectionItem.tsx +++ b/src/renderer/src/components/editor/DiffSectionItem.tsx @@ -101,11 +101,11 @@ export function DiffSectionItem({ ) : ( )} - - {fileName} - {section.dirty && M} + + {fileName} + {section.dirty && M} + {dirPath && {dirPath}} - {dirPath && {dirPath}} - - - - - e.preventDefault()} - > - startNew('file', worktreePath, 0)}> - - New File - - startNew('folder', worktreePath, 0)}> - - New Folder - - - + void + point: { x: number; y: number } + worktreePath: string + onStartNew: (type: 'file' | 'folder', dir: string, depth: number) => void +}): React.JSX.Element { + return ( + + + + + e.preventDefault()} + > + onStartNew('file', worktreePath, 0)}> + + New File + + onStartNew('folder', worktreePath, 0)}> + + New Folder + + + + ) +} diff --git a/src/renderer/src/components/right-sidebar/SearchResultItems.tsx b/src/renderer/src/components/right-sidebar/SearchResultItems.tsx index 3c7a30e30..1ee747898 100644 --- a/src/renderer/src/components/right-sidebar/SearchResultItems.tsx +++ b/src/renderer/src/components/right-sidebar/SearchResultItems.tsx @@ -74,10 +74,12 @@ export function FileResultRow({ )} /> - {fileName} - {dirPath && ( - {dirPath} - )} + + {fileName} + {dirPath && ( + {dirPath} + )} + {fileResult.matches.length} diff --git a/src/renderer/src/components/right-sidebar/SourceControl.tsx b/src/renderer/src/components/right-sidebar/SourceControl.tsx index 4fafa4ff4..92ee12ec1 100644 --- a/src/renderer/src/components/right-sidebar/SourceControl.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControl.tsx @@ -943,12 +943,10 @@ function UncommittedEntryRow({ > - - {fileName} - {dirPath && ( - {dirPath} - )} - + + {fileName} + {dirPath && {dirPath}} + {conflictLabel && ( {conflictLabel} )}