Skip to content

Add source diff viewer#101

Open
Toubat wants to merge 4 commits intoshareAI-lab:mainfrom
Toubat:brian/diff-view
Open

Add source diff viewer#101
Toubat wants to merge 4 commits intoshareAI-lab:mainfrom
Toubat:brian/diff-view

Conversation

@Toubat
Copy link

@Toubat Toubat commented Mar 19, 2026

Summary

Add a diff mode to the version page code viewer so readers can compare the current session against another version

What changed

  • added VersionCompareTarget and passed compare metadata through the version page client
  • updated SourceViewer with:
    • View Source / View Diff toggle
    • version comparison dropdown in diff mode
    • line-by-line diff rendering with add/remove/context styling
  • added new i18n strings for compare UI
  • added diff-utils.ts and tests
Screenshot 2026-03-19 at 2 32 57 AM Screenshot 2026-03-19 at 2 35 16 AM

Toubat added 3 commits March 19, 2026 01:45
Introduce a new diff utility (web/src/lib/diff-utils.ts) and accompanying test (web/src/lib/diff-utils.test.ts), add a test npm script to package.json to run the test, and update source viewer and learning pages to consume the new utility. Also update generated docs and versions data to reflect the changes.
Expose version comparison targets and UI so users can select a previous version to diff against. Introduces VersionCompareTarget type and updates page/client props (currentVersionId, defaultCompareVersionId, compareTargets). The page now builds compareTargets from generated versions and passes them to the client. SourceViewer was refactored to add a compare dropdown, improved diff/source toggle, and uses the selected target's source for computeDiffRows (with selection reset when currentVersionId changes). Also adds i18n keys (compare_with, select_compare_target) for en/ja/zh and various UI/animation refinements.
Remove the empty/placeholder clear button from the compare dropdown and stop force-switching back to source when a base becomes unavailable. Clicking the Diff button now attempts to auto-select a fallback compare target (defaultCompareVersionId or the first compare target) before entering diff mode, and an empty-state message is shown when no base is selected. Also replace a motion.label with motion.div and simplify diff button classes to support the new flow and animations.
@vercel
Copy link

vercel bot commented Mar 19, 2026

@Toubat is attempting to deploy a commit to the crazyboym's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant