Skip to content

feat: sync git diff sidebar with scroll; sticky file headers and edge-to-edge diffs#84

Merged
Dimillian merged 5 commits intomainfrom
codex/improve-git-diff-main-panel-ui
Jan 18, 2026
Merged

feat: sync git diff sidebar with scroll; sticky file headers and edge-to-edge diffs#84
Dimillian merged 5 commits intomainfrom
codex/improve-git-diff-main-panel-ui

Conversation

@Dimillian
Copy link
Owner

Motivation

  • Improve discoverability when scanning a multi-file diff by keeping the current file context visible and the sidebar selection in sync with the scrolled file.
  • Remove the visual "card" effect so diff entries render edge-to-edge for a cleaner, denser diff view.
  • Avoid scroll/selection loops when updating the sidebar as the user scrolls.

Description

  • Added an onActivePathChange callback to GitDiffViewer and implemented a scroll listener that determines the top-most visible virtual item and calls onActivePathChange with the file path while avoiding update loops using activePathRef and lastScrolledPathRef (src/features/git/components/GitDiffViewer.tsx).
  • Wired the selected diff path through the layout and panel by passing selectedDiffPath into GitDiffPanel from useLayoutNodes and accepting selectedPath in GitDiffPanel to add the active class to the corresponding sidebar row (src/features/layout/hooks/useLayoutNodes.tsx, src/features/git/components/GitDiffPanel.tsx).
  • Removed diff card styling and made file headers sticky by updating src/styles/diff-viewer.css to render items edge-to-edge, remove rounded card borders, and add a sticky .diff-viewer-header so the filename stays visible while scrolling.
  • Kept the existing virtualizer scroll-to behavior when a file is explicitly selected so clicking a sidebar file still scrolls it into view (rowVirtualizer.scrollToIndex remains in GitDiffViewer).

Testing

  • Ran npm run lint and the lint step completed successfully.
  • Ran npm run typecheck (tsc --noEmit) and type checking completed successfully.

Codex Task

@Dimillian
Copy link
Owner Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d984a7448

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Dimillian
Copy link
Owner Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Dimillian Dimillian changed the title Sync git diff sidebar with scroll; sticky file headers and edge-to-edge diffs feat: sync git diff sidebar with scroll; sticky file headers and edge-to-edge diffs Jan 18, 2026
@Dimillian Dimillian merged commit 0ba5a32 into main Jan 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant