Skip to content

Merge test into main#1605

Merged
sweetmantech merged 1 commit intomainfrom
test
Mar 28, 2026
Merged

Merge test into main#1605
sweetmantech merged 1 commit intomainfrom
test

Conversation

@sweetmantech
Copy link
Copy Markdown
Collaborator

Syncing test branch into main after merging PR #1604 (image preview on /files page).

* feat: add image preview support on /files page

When clicking an image file on the /files tab, show the image using a
signed URL instead of "Preview not available for this file type".

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* feat: add sandbox image preview on /files page

Add image preview support for sandbox (GitHub repo) files on the /files
page. The previous commit only handled Supabase-stored files via
FileInfoDialog. This adds support for the SandboxFilePreview path by:

- Adding getImageContent() to fetch base64 image data via API format=base64
- Extending useSandboxFileContent hook to detect images and return data URLs
- Adding imageUrl prop to FilePreview as alternative to storageKey
- Passing imageUrl through SandboxFilePreview and SandboxFileTree

Depends on API PR #364 (base64 format support for sandbox file endpoint).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: remove format=base64 query param, API auto-detects binary files

The API now auto-detects binary files by extension and returns base64
encoding automatically — no need to pass format=base64 in the request.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: consolidate getImageContent into getFileContents, fix loading UX

Address PR review feedback:
- Eliminate getImageContent.ts — the API auto-detects binary files, so
  getFileContents now handles base64 responses and builds data URLs
- Validate data.content before constructing data URLs
- Fix loading state showing false "Preview not available" for images by
  moving loading/error checks before image/isTextFile checks
- Add a spinner to the loading state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: remove storageKey from FilePreview (YAGNI)

storageKey/signed-URL image previews for Supabase-stored files are not
part of this PR's scope. Remove the prop to keep the change focused on
sandbox GitHub image previews only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* revert: drop formatting-only changes to FileInfoDialogContent

Not part of this PR's scope — keeps the diff focused.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: extract getMimeType into existing getMimeFromPath utility (SRP)

Add image MIME types to the existing getMimeFromPath utility and reuse
it in getFileContents instead of an inline function.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: use Skeleton for loading state, move MIME util to lib/files

- Replace loading spinner with shadcn Skeleton component in FilePreview
- Create lib/files/getImageMimeType.ts instead of modifying utils/ (SRP)
- Revert utils/getMimeFromPath.ts to base branch state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: move getMimeFromPath from utils/ to lib/files/, add image MIME types

Move getMimeFromPath to lib/files/ per project conventions (no utils/ path).
Add image MIME types (png, jpg, jpeg, gif, webp, svg) to the existing map
so it can be reused for both text and image MIME resolution (DRY).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: extract FilePreviewSkeleton into its own component (SRP)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: CTO Agent <cto@recoupable.com>
Co-authored-by: Paperclip <noreply@paperclip.ing>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Sweets Sweetman <sweetmantech@gmail.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-chat Ready Ready Preview Mar 30, 2026 2:59am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 28, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 7 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 21 minutes and 7 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b328a5ad-6580-49ee-a416-ac49a394c734

📥 Commits

Reviewing files that changed from the base of the PR and between ad98dd5 and 82feae0.

📒 Files selected for processing (8)
  • components/Files/FilePreview.tsx
  • components/Files/FilePreviewSkeleton.tsx
  • components/Sandboxes/SandboxFilePreview.tsx
  • components/Sandboxes/SandboxFileTree.tsx
  • hooks/useSandboxFileContent.ts
  • hooks/useSaveKnowledgeEdit.ts
  • lib/files/getMimeFromPath.ts
  • lib/sandboxes/getFileContents.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sweetmantech sweetmantech merged commit 0a6fc82 into main Mar 28, 2026
2 of 3 checks passed
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.

2 participants