From 6ac2e30c8fc8bfbc8414ecf9f244e48c09d1336e Mon Sep 17 00:00:00 2001 From: vineyardbovines Date: Wed, 3 Jun 2026 13:34:29 -0400 Subject: [PATCH] Drop carousel naming, cap gallery MediaPreview to 4 tiles Renames `GRID_TO_CAROUSEL_THRESHOLD` -> `MAX_GRID_IMAGES` and `carouselEnabled` -> `useExpandedLayout` in ImageEmbed so the render-path decision reads as a count threshold rather than naming the component that happens to live downstream today. Also slices the gallery branch of MediaPreview to the first 4 items so a 10-image gallery doesn't overflow the inline notification/DM row. --- src/components/MediaPreview.tsx | 4 +++- src/components/Post/Embed/ImageEmbed.tsx | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/MediaPreview.tsx b/src/components/MediaPreview.tsx index 98628844f9..996e3b18e8 100644 --- a/src/components/MediaPreview.tsx +++ b/src/components/MediaPreview.tsx @@ -48,9 +48,11 @@ export function Embed({ ) } else if (e.type === 'gallery') { + // Notification/DM preview is a narrow inline strip; cap at 4 tiles so + // a 10-image gallery doesn't blow out the row width. return ( - {e.view.items.map(item => { + {e.view.items.slice(0, 4).map(item => { const image: AppBskyEmbedImages.ViewImage = { thumb: item.thumbnail, fullsize: item.fullsize, diff --git a/src/components/Post/Embed/ImageEmbed.tsx b/src/components/Post/Embed/ImageEmbed.tsx index c3f77bd33f..5b51c29f5b 100644 --- a/src/components/Post/Embed/ImageEmbed.tsx +++ b/src/components/Post/Embed/ImageEmbed.tsx @@ -16,7 +16,7 @@ import {useAnalytics} from '#/analytics' import {type EmbedType} from '#/types/bsky/post' import {type CommonProps} from './types' -const GRID_TO_CAROUSEL_THRESHOLD = 4 +const MAX_GRID_IMAGES = 4 export function ImageEmbed({ embed, @@ -35,9 +35,9 @@ export function ImageEmbed({ aspectRatio: item.aspectRatio, })) : embed.view.images - const carouselEnabled = + const useExpandedLayout = embed.type === 'gallery' - ? images.length > GRID_TO_CAROUSEL_THRESHOLD + ? images.length > MAX_GRID_IMAGES : ax.features.enabled(ax.features.PostGalleryEmbedEnable) // Captured from AutoSizedImage so the peek-commit handler can reuse the same @@ -127,7 +127,7 @@ export function ImageEmbed({ ) } - if (carouselEnabled) { + if (useExpandedLayout) { return (