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 (