Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds json previews #107

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Adds json previews #107

wants to merge 5 commits into from

Conversation

andrewxhill
Copy link

JSON Preview Enhancement

This PR improves the JSON file preview functionality in the Object component, making it more robust and user-friendly.

Changes

  • Enhanced JSON content detection and rendering
  • Added proper whitespace preservation for JSON formatting
  • Improved MIME type detection for JSON files
  • Added comprehensive JSDoc documentation for component and key functions

Technical Details

  • JSON files are now properly detected through both content-type headers and file extensions
  • Added validation of JSON content before rendering
  • Implemented pretty-printing with proper indentation (2 spaces)
  • Preserved whitespace formatting specifically for JSON content
  • Maintained size-based content truncation with full content toggle

Testing

The changes can be tested by:

  1. Viewing any JSON file in a bucket
  2. Verifying that the content is properly formatted with indentation
  3. Testing large JSON files to ensure truncation and "Show Full Content" work correctly
  4. Checking that malformed JSON files fallback gracefully to plain text display

Screenshots

Screenshot 2025-03-13 at 9 02 55 AM

Copy link

vercel bot commented Mar 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
faucet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 24, 2025 4:04pm
portal ❌ Failed (Inspect) Mar 24, 2025 4:04pm

@andrewxhill andrewxhill requested a review from asutula March 13, 2025 15:07
@asutula asutula mentioned this pull request Mar 21, 2025
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