From 85dbd2f16e58e85560843a14d3d7a416b213e0ef Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Thu, 4 Jun 2026 11:34:37 -0700 Subject: [PATCH] fix: address review findings (#4653) --- .../sidebar/WorktreeList.lineage-child-card.test.ts | 4 ++-- .../sidebar/worktree-list-indentation.test.ts | 12 +++++++++--- .../components/sidebar/worktree-list-indentation.ts | 6 +++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/components/sidebar/WorktreeList.lineage-child-card.test.ts b/src/renderer/src/components/sidebar/WorktreeList.lineage-child-card.test.ts index d80e67c17..01e080adf 100644 --- a/src/renderer/src/components/sidebar/WorktreeList.lineage-child-card.test.ts +++ b/src/renderer/src/components/sidebar/WorktreeList.lineage-child-card.test.ts @@ -582,7 +582,7 @@ describe('WorktreeList lineage child card renderer', () => { expect(parentRow).not.toContain('padding-left') expect(markup).toContain( - '
' + '
' ) }) @@ -594,7 +594,7 @@ describe('WorktreeList lineage child card renderer', () => { expect(parentRow).not.toContain('padding-left') expect(markup).toContain( - '
' + '
' ) }) }) diff --git a/src/renderer/src/components/sidebar/worktree-list-indentation.test.ts b/src/renderer/src/components/sidebar/worktree-list-indentation.test.ts index ae5113ff6..8c0dde83b 100644 --- a/src/renderer/src/components/sidebar/worktree-list-indentation.test.ts +++ b/src/renderer/src/components/sidebar/worktree-list-indentation.test.ts @@ -12,18 +12,24 @@ describe('worktree list indentation', () => { ) }) + it('keeps ungrouped lineage indentation on the base tree step', () => { + expect(getWorktreeCardContentIndent({ isGrouped: false, groupDepth: 4, lineageDepth: 2 })).toBe( + 36 + ) + }) + it('indents workspace content one step deeper than its containing project header', () => { expect(getWorktreeCardContentIndent({ isGrouped: true, groupDepth: 0, lineageDepth: 0 })).toBe( - 18 + 20 ) expect(getWorktreeCardContentIndent({ isGrouped: true, groupDepth: 1, lineageDepth: 0 })).toBe( - 36 + 38 ) }) it('adds lineage depth after project/group depth', () => { expect(getWorktreeCardContentIndent({ isGrouped: true, groupDepth: 1, lineageDepth: 2 })).toBe( - 72 + 74 ) }) diff --git a/src/renderer/src/components/sidebar/worktree-list-indentation.ts b/src/renderer/src/components/sidebar/worktree-list-indentation.ts index bca9f2578..6bfc3dc7e 100644 --- a/src/renderer/src/components/sidebar/worktree-list-indentation.ts +++ b/src/renderer/src/components/sidebar/worktree-list-indentation.ts @@ -1,4 +1,7 @@ export const SIDEBAR_TREE_INDENT = 18 +// Why: project-grouped cards need to read as children even after the card +// surface inset is subtracted, while lineage rows keep the base tree step. +const PROJECT_WORKTREE_CARD_EXTRA_INDENT = 2 export const PROJECT_GROUP_HEADER_BASE_PADDING = 10 // Why: workspace/status headers and project headers occupy the same sidebar // row role, so their titles should not shift when switching grouping modes. @@ -23,5 +26,6 @@ export function getWorktreeCardContentIndent(args: { lineageDepth: number }): number { const groupSteps = args.isGrouped ? clampDepth(args.groupDepth) + 1 : 0 - return (groupSteps + clampDepth(args.lineageDepth)) * SIDEBAR_TREE_INDENT + const projectCardIndent = args.isGrouped ? PROJECT_WORKTREE_CARD_EXTRA_INDENT : 0 + return (groupSteps + clampDepth(args.lineageDepth)) * SIDEBAR_TREE_INDENT + projectCardIndent }