handle images in file viewer and diff viewer#1166
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis pull request introduces image file viewing support to the desktop application. It adds a new TRPC procedure Changes
Sequence DiagramsequenceDiagram
participant UI as FileViewerPane (UI)
participant Hook as useFileContent (Hook)
participant TRPC as TRPC Client
participant Server as readWorkingFileImage (Server)
participant FS as File System
UI->>Hook: Request file content with viewMode="rendered"
Hook->>Hook: Check if file is image
alt File is Image
Hook->>TRPC: Call readWorkingFileImage(filePath, worktreePath)
TRPC->>Server: readWorkingFileImage procedure
Server->>FS: Read image file
FS-->>Server: File bytes
Server->>Server: Validate size ≤ 10 MiB
Server->>Server: Detect MIME type
Server->>Server: Encode to base64 data URL
Server-->>TRPC: Return {dataUrl, byteLength} or error
TRPC-->>Hook: Image data with result status
Hook-->>UI: {imageData, isLoadingImage}
else File is not Image
Hook->>Hook: Skip image query
Hook-->>UI: {imageData: undefined, isLoadingImage: false}
end
UI->>UI: Render image or error message based on imageData
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit
New Features
UI Updates