Skip to content

feat: Add git-style split diff visualization for AI changes in file preview - #47

Open
ugoocreates-pixel wants to merge 2 commits into
Ender-Stellar:mainfrom
ugoocreates-pixel:feature/diff-viewer
Open

feat: Add git-style split diff visualization for AI changes in file preview#47
ugoocreates-pixel wants to merge 2 commits into
Ender-Stellar:mainfrom
ugoocreates-pixel:feature/diff-viewer

Conversation

@ugoocreates-pixel

Copy link
Copy Markdown

this pr closes #21

Description

This pull request integrates split diff visualization for AI changes when edits are applied to existing sandbox files. Instead of only showing the final rewritten code, users can now view a git-style side-by-side split diff comparing the original sandbox file content with the newly edited version from the AI.

Key Changes

  • Added Dependency: Integrated @alexbruf/react-diff-viewer to support React 19 compatibility.
  • Dynamic Imports: Loaded the diff viewer dynamically with ssr: false to ensure seamless Next.js production builds.
  • Dual Tab Mode: Introduced a sub-header toolbar in the file preview view with Diff View and Source Code options.
  • Smart Defaults: Defaults to Diff View when a file has existing content in the workspace, allowing the user to review edits before writing.
  • Dark Theme Sync: Configured customized dark theme colors for the diff viewer matching the surrounding developer interface.

Verification

  • Verified Next.js compatibility and passed the TypeScript compiler checks (tsc --noEmit) without any typing issues.

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.

frontend: Code Diff visualization when applying AI changes

1 participant