feat: optimize Files Changed view to display renamed file#2021
Open
juanlou1217 wants to merge 1 commit intoweb3infra-foundation:mainfrom
Open
feat: optimize Files Changed view to display renamed file#2021juanlou1217 wants to merge 1 commit intoweb3infra-foundation:mainfrom
juanlou1217 wants to merge 1 commit intoweb3infra-foundation:mainfrom
Conversation
Member
|
@codex review |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the DiffView “Files Changed” UI to better represent renamed files by rendering them as “old path → new path”, using rename metadata when available.
Changes:
- Extend diff parsing output to carry
old_path/oldPathfor renamed files. - Update the file header rendering in
FileDiffto displayoldPath → pathfor renames.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| moon/apps/web/components/DiffView/parsedDiffs.ts | Thread old_path from API diff items into parsed diff structures as oldPath. |
| moon/apps/web/components/DiffView/FileDiff.tsx | Render renamed files as “oldPath → newPath” in the diff list header. |
Comment on lines
5
to
33
| @@ -26,12 +27,15 @@ export function parsedDiffs(diffText: DiffItem[]): { path: string; lang: string; | |||
| return { | |||
| path: block.path, | |||
| lang: isBinary ? 'binary' : 'auto', | |||
| diff | |||
| diff, | |||
| oldPath: block.old_path | |||
| } | |||
| }) | |||
Comment on lines
229
to
+260
| @@ -247,7 +248,17 @@ export default function FileDiff({ | |||
| ) : ( | |||
| <ExpandIcon className='align-middle text-xl' /> | |||
| )} | |||
| <span className='ml-1'>{file.path}</span> | |||
| <span className='ml-1'> | |||
| {isRenamed && file.oldPath ? ( | |||
| <span> | |||
| <span className='text-secondary line-through'>{file.oldPath}</span> | |||
| <span className='text-secondary mx-1'>→</span> | |||
| <span>{file.path}</span> | |||
| </span> | |||
| ) : ( | |||
| file.path | |||
| )} | |||
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
改变原有“先删除再添加”的展示逻辑,直接渲染为“旧路径 → 新路径”。