Skip to content

feat(web): implement side-by-side Monaco interactive code diff viewer - #1247

Merged
ayomideadeniran merged 1 commit into
StellarDevHub:mainfrom
codexhange:feat/monaco-diff-viewer-1145
Sep 3, 2026
Merged

feat(web): implement side-by-side Monaco interactive code diff viewer#1247
ayomideadeniran merged 1 commit into
StellarDevHub:mainfrom
codexhange:feat/monaco-diff-viewer-1145

Conversation

@codexhange

Copy link
Copy Markdown
Contributor

Summary

Implement a complete Monaco-based diff comparison component that lets students compare their working contract code against model solutions and compiler fixes.

Features

  • Monaco DiffEditor with inline and side-by-side split view toggles
  • Character-level diff highlighting for Rust syntax and Soroban macros via custom Monaco theme
  • 1-click "Apply Diff Chunk" controls merging selected solution blocks into the student buffer
  • Web Worker for off-thread diff computation to prevent UI thread stutter on large files
  • Dark, light, and OLED theme support
  • Hunk-level apply with context preservation and stale-hunk detection

Files Added

  • frontend/src/lib/diff/diffUtils.ts — Pure diff utilities (computeDiffHunks, applyHunk, applyHunks) using diff-match-patch
  • frontend/src/lib/diff/diff.worker.ts — Web Worker for off-thread diff computation
  • frontend/src/components/diff/DiffViewer.tsx — Main React component with Monaco DiffEditor, hunk list, and apply controls
  • frontend/src/components/diff/index.ts — Barrel export

Acceptance Criteria

  • Large multi-file diffs render smoothly at 60fps (Web Worker computation)
  • Students can selectively merge solution chunks directly into their active workspace (per-hunk Apply)
  • Diff viewer supports dark, light, and OLED themes seamlessly (theme prop + custom Monaco theme)

Closes #1145

🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@codexhange Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@codexhange is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread frontend/src/lib/diff/diff.worker.ts Fixed
@adeniran19-maker

Copy link
Copy Markdown

@codexhange PR under review — I will get back to you if I find any wrong implementations.

Add a complete diff comparison component that lets students compare their
working contract code against model solutions and compiler fixes.

Features:
- Monaco DiffEditor with inline and side-by-side split view toggles
- Character-level diff highlighting for Rust syntax and Soroban macros
- 1-click "Apply Diff Chunk" controls merging selected solution blocks
  into the student buffer
- Diff computation offloaded to a Web Worker to prevent UI thread stutter
- Dark, light, and OLED theme support via custom Monaco theme
- Hunk-level apply with context preservation and stale-hunk detection
- Full keyboard accessibility with ARIA labels

Closes StellarDevHub#1145

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@ayomideadeniran
ayomideadeniran force-pushed the feat/monaco-diff-viewer-1145 branch from 9a358d2 to 0cb04a7 Compare September 3, 2026 12:42
@ayomideadeniran
ayomideadeniran merged commit 0135b88 into StellarDevHub:main Sep 3, 2026
3 of 11 checks passed
message: err instanceof Error ? err.message : 'Diff computation failed.',
});
// Handle both InteractiveDiffViewer (type: 'diff') and DiffViewer (id, original, modified)
self.onmessage = (event: MessageEvent<any>) => {
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] Implement Side-by-Side Monaco Interactive Code Diff Viewer

4 participants