diff --git a/src/renderer/components/FileChangesPanel.tsx b/src/renderer/components/FileChangesPanel.tsx index d6d63889b..391244f32 100644 --- a/src/renderer/components/FileChangesPanel.tsx +++ b/src/renderer/components/FileChangesPanel.tsx @@ -507,18 +507,36 @@ const FileChangesPanelComponent: React.FC = ({ } }; - const renderPath = (p: string) => { + const renderPath = (p: string, status?: FileChange['status']) => { const last = p.lastIndexOf('/'); const dir = last >= 0 ? p.slice(0, last + 1) : ''; const base = last >= 0 ? p.slice(last + 1) : p; + const isDeleted = status === 'deleted'; return ( - {base} - {dir && {dir}} + + {base} + + {dir && ( + + {dir} + + )} ); }; + const shouldShowDiffPill = (value: number | null | undefined) => + typeof value === 'number' && value !== 0; + // Use PR diff changes when in PR review mode, otherwise use local file changes const displayChanges = isPrReview ? prDiffChanges : fileChanges; const displayLoading = isPrReview ? prDiffLoading : isLoading; @@ -867,16 +885,22 @@ const FileChangesPanelComponent: React.FC = ({
-
{renderPath(change.path)}
+
+ {renderPath(change.path, change.status)} +
- - +{formatDiffCount(change.additions)} - - - -{formatDiffCount(change.deletions)} - + {change.status !== 'deleted' && shouldShowDiffPill(change.additions) && ( + + +{formatDiffCount(change.additions)} + + )} + {change.status !== 'deleted' && shouldShowDiffPill(change.deletions) && ( + + -{formatDiffCount(change.deletions)} + + )}
)) @@ -895,16 +919,22 @@ const FileChangesPanelComponent: React.FC = ({
-
{renderPath(change.path)}
+
+ {renderPath(change.path, change.status)} +
- - +{formatDiffCount(change.additions)} - - - -{formatDiffCount(change.deletions)} - + {change.status !== 'deleted' && shouldShowDiffPill(change.additions) && ( + + +{formatDiffCount(change.additions)} + + )} + {change.status !== 'deleted' && shouldShowDiffPill(change.deletions) && ( + + -{formatDiffCount(change.deletions)} + + )}