Add a commit details panel#42
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds first-class commit metadata support and an inline “commit details” panel that renders as part of the diff scroller, along with a small refactor for copy-to-clipboard UI state.
Changes:
- Add
CommitMetadatatypes, wire commit metadata into repository state, and implement git-side metadata extraction in Electron. - Render a commit details panel as a
CodeViewitem (with dedicated styling) and enable smooth/instant scroll targeting behaviors. - Extract repeated “copied” timer logic into a reusable
useCopiedStatehook and adopt it in multiple components.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Introduces commit metadata types and adds commitMetadata to RepositoryState. |
| src/lib/app-types.ts | Adds scroll target/behavior types and a new commit-details annotation metadata variant. |
| electron/git-state/commit.cjs | Plumbs commit metadata loading into commit-state reads. |
| electron/git-state/commit-metadata.cjs | New module to read/parse commit metadata (refs, trailers, numstat, signature, etc.). |
| src/app/components/ReviewCodeView.tsx | Adds commit details CodeView item, scroll behavior support, and wiring to render the panel. |
| src/app/components/CommitDetails.tsx | New UI component to display commit details and file list navigation. |
| src/lib/code-view-options.ts | Adds CSS overrides to hide file UI around the commit details item. |
| src/app/components/useCopiedState.ts | New reusable hook for “Copied” feedback state with timer cleanup. |
| src/app/components/Panels.tsx | Refactors copy-comments button to use useCopiedState. |
| src/App.tsx | Adds typed scroll target behavior and passes commit metadata into ReviewCodeView. |
| src/App.css | Adds styles for the commit details panel and related UI. |
| src/tests/git-state.test.ts | Adds tests for commit metadata extraction (root commits, trailers, renames, tab paths). |
| src/tests/ReviewCodeView-scroll.test.tsx | Adds test coverage for commit-details file row navigation and scroll behavior. |
| src/tests/App-render.test.tsx | Adds render/copy/signature formatting coverage for the commit details panel. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+775
to
+786
| // Build an id from commit details that can change the panel height. When the panel first appears, | ||
| // we change only layoutPass to make CodeView measure again; this id still means "same content." | ||
| const getCommitDetailsContentKey = (metadata: CommitMetadata) => | ||
| [ | ||
| metadata.ref, | ||
| metadata.refs.join('\u0000'), | ||
| metadata.stats.files, | ||
| metadata.stats.additions, | ||
| metadata.stats.deletions, | ||
| metadata.stats.renamedFiles, | ||
| metadata.stats.binaryFiles, | ||
| ].join('\u0001'); |
a17e695 to
93c3d2b
Compare
Show commit details for history reviews, including metadata, signature state, trailers, stats, and changed files. Let file rows jump to their diff target while preserving instant reload restoration.
93c3d2b to
5f40792
Compare
Member
|
Made a bunch of styling improvements and going to ship this as 1.0.0 now. Thank you for all your contributions! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a commit details panel for commit reviews from the History tab.
The panel only appears when viewing a committed change. It does not show for local uncommitted changes.
The panel shows the commit message, author, committer, refs, parents, signature, trailers, file stats, and the files changed in the commit.
Changed files in the panel are clickable, so you can jump straight to that file in the diff. Reloading keeps the restored scroll position instant, while clicking a file scrolls smoothly to it (can change it to instant if you prefer).
I added the commit details panel as a fake item in the diff list. This keeps the diff view simple; the panel scrolls with the files, reloads restore the right position, and clicking a file can use the same navigation path as the rest of the diff.
Validation
vp check --fixvp buildvp test src/__tests__/App-render.test.tsx