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

feat: Add thumbnails support for files in grid view #2337

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

Conversation

george-hub331
Copy link

Closes #2301

This PR adds thumbnail support for files in the IPFS WebUI grid view, improving the visual browsing experience.

Changes:

  • Enhanced FileThumbnail component to handle both image and text previews
  • Added efficient loading states and error handling
  • Optimized text preview loading with size limits
  • Improved thumbnail styling and layout
  • Maintained existing functionality while adding preview features
  • Translations done with google translate

The thumbnails are implemented with:

  • Lazy loading for images to improve performance
  • Text preview for common text file formats
  • Loading states to provide better UX
  • Error handling to gracefully fallback to file icons
  • Size limits on text previews to prevent performance issues

Testing:

  • Tested with various image formats
  • Verified text file preview functionality
  • Confirmed loading states work correctly
  • Checked error handling for invalid files
  • Verified performance with multiple files

Introduces a new grid view mode for the files page, allowing users to switch between list and grid views. Includes:
- New FilesGrid component
- View mode toggle buttons
- Shared props between list and grid views
- Updated rendering logic to support both view modes
Adds multi-select functionality and improved keyboard navigation to the files page grid view:
- Implement file selection with checkboxes
- Add keyboard navigation between files
- Create a new SelectedActions component for bulk operations
- Update styling to support selection and focus states
- Adjust GridFile thumbnail opacity for better visual appearance
- Add select all checkbox for grid view
- Move selected state management to parent component
- Refactor file selection logic to support bulk and individual selection
- Minor UI layout adjustments
- Implement text preview for text-based files in Grid File
- Add support for reading file contents with doRead action
- Enhance FileThumbnail to display text previews
- Add localized "Select all entries" text across language files, this was done using google translate
@george-hub331 george-hub331 requested a review from a team as a code owner February 23, 2025 22:51
Copy link

welcome bot commented Feb 23, 2025

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@george-hub331
Copy link
Author

Hey @lidel, could you take a look at my PR when you get a chance? Would really appreciate your review!

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing this, it is amazing work 😻
See some feedback/asks inline.

Snapshot of current state for posterity

image
image

george-hub331 and others added 9 commits March 1, 2025 14:49
- Move view mode buttons to Header component
- Truncate file hash in grid view for better readability
- Adjust Header layout and styling
- Add translation for view mode
- Apply consistent height to view mode buttons in FilesPage
- Adjust Header component margins and layout
- Add responsive margin for breadcrumbs header
- Implement keyboard shortcut modal with comprehensive keyboard navigation
- Add drop zone and drag-and-drop functionality for files in grid view
- Enhance list file navigation and selection with improved keyboard controls
- Add visual indicators for drag and drop interactions in grid view
@george-hub331
Copy link
Author

hey @lidel, i've been able to resolve all feedbacks/asks

lidel added 2 commits March 4, 2025 22:53
moving 2px and changing border weight does not render well
and makes ui jiggle.

switching to static sizing + reusing dotted border convention from
the old Files screen
we do not use shadows in UI anywhere else, let's keep grid view UI
simple and follow similar visual indicators as list view
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, thank you.

I've pushed small cosmetics to unify UI conventions in both views.
(the bold border which I requested caused UI to jiggle – I've reverted it and simplified UI to not move 2px around. This should work better on systems with unstable font rendering – removing surface for jiggling on some Linux boxes)

@SgtPooki mind taking a look with fresh set of eyes and merging if no concerns?

The thumbnails grid view can be enabled by clicking on this icon:

image

@george-hub331
Copy link
Author

Oh great!, Thanks for the changes too @lidel

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.

Add Thumbnails to files
3 participants