feat(desktop): preview image diffs in SCM pane
Merged
TH
2mo ago+162+162+012345678901234567890123456789-21-21-01234567890123456789
Summary
- Render inline previews for supported image files in the desktop Changes pane, using the same placeholder layout as the deferred-diff and binary states (icon, text line, Open file).
- Reuse the existing image extension and MIME-type helpers and the workspace
filesystem.readFileprocedure with a 10MB cap. - Keep the Open file action and the binary-file fallback for unsupported, deleted, failed, or oversized files.
- Refetch a preview when git reports that path changed; unrelated edits leave previews alone.
- Draw transparent images on the same checkerboard the file pane's ImageView uses.
How to run and test
- Run
./.superset/setup.local.shonce in a workspace. - Run
bun run dev. - Open a workspace with staged or unstaged image changes.
- Open the Changes pane and select the image diff.
- Confirm PNG/JPEG previews render inline and Open file still works.
- Replace the image on disk and confirm the preview updates; delete a tracked image and confirm it falls back to "Binary file hidden".
Validation
bun run lintbun run --cwd apps/desktop typecheckbun run check:i18n(one new string, "Loading image…", translated in all 16 locales)bun testfor the DiffPane folder- Verified in the dev desktop app: added and modified PNGs preview, an on-disk replacement refetches, a deleted image falls back to the binary placeholder without Open file.
Image example
Scope note
The preview reads the current worktree bytes, so it is shown for working-tree and against-base diffs only. Commit refs keep the plain binary placeholder, since the worktree may no longer hold the commit's version of the file. A true old-vs-new visual comparison is left for a follow-up.