feat(frontend): add image optimization with thumb() utility#14
Merged
Conversation
- Add src/lib/image.ts with thumb() function and ImageSize constants - thumb() appends ?w=WIDTH query params for vault-proxy server-side resizing - Graceful degradation: params ignored when served directly from R2/S3 Updated components: - ReviewGridItem: Grid thumbnails (MD), List thumbnails (XS) - DraftTableRow: Table thumbnails (XS), lightbox unchanged - ReviewDetailPanel: Preview (LG), lightbox unchanged - Dashboard: All grid images (SM), schedule list (XS) - Scheduled: Table thumbnails (XS), lightbox unchanged - Published: Table thumbnails (XS), lightbox unchanged - Schedule: All card thumbnails (XS) - EditDeviation: File previews (MD)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds server-side image resizing support to the frontend via a new
thumb()utility function.Changes
New:
apps/isekai-frontend/src/lib/image.tsthumb(url, width, options?)- generates optimized image URLs with resize query paramsImageSizeconstants: XS (128), SM (256), MD (400), LG (800), XL (1200)Updated components:
How it works
When served through vault-proxy, the
?w=400(or similar) query params trigger server-side image resizing. When served directly from R2/S3, the params are ignored for graceful degradation.Testing