Skip to content

feat: optimize Files Changed view to display renamed file#2021

Open
juanlou1217 wants to merge 1 commit intoweb3infra-foundation:mainfrom
juanlou1217:feat/file_rename
Open

feat: optimize Files Changed view to display renamed file#2021
juanlou1217 wants to merge 1 commit intoweb3infra-foundation:mainfrom
juanlou1217:feat/file_rename

Conversation

@juanlou1217
Copy link
Contributor

image

改变原有“先删除再添加”的展示逻辑,直接渲染为“旧路径 → 新路径”。

@genedna genedna requested a review from Copilot March 14, 2026 17:33
@genedna
Copy link
Member

genedna commented Mar 14, 2026

@codex review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/oldPath for renamed files.
  • Update the file header rendering in FileDiff to display oldPath → path for 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
)}
@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Hooray!

ℹ️ 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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants