terry-media-adaptive-trial #10

Merged
terry merged 4 commits from terry-media-adaptive-trial into main 2026-05-29 16:21:39 +00:00
Showing only changes of commit 789920d2b9 - Show all commits

View File

@@ -27,60 +27,70 @@ export function AlbumBubble({ post }: { post: Post }) {
return ( return (
<div className="flex flex-col"> <div className="flex flex-col">
{/* aspect-ratio lives on the wrapper so the grid gets a *definite* height
(inset-0) and its fr rows stretch instead of collapsing to content. */}
<div <div
className="grid overflow-hidden bg-black" className="relative w-full overflow-hidden bg-black"
style={{ style={{
gap: ALBUM_GAP,
gridTemplateColumns: layout?.gridTemplateColumns,
gridTemplateRows: layout?.gridTemplateRows,
aspectRatio: layout?.aspectRatio, aspectRatio: layout?.aspectRatio,
maxHeight: ALBUM_MAX_HEIGHT, maxHeight: ALBUM_MAX_HEIGHT,
}} }}
> >
{visible.map((att, i) => { <div
const isLastSlot = i === MAX_VISIBLE - 1 && extra > 0; className="absolute inset-0 grid"
const tile = layout?.tiles[i]; style={{
return ( gap: ALBUM_GAP,
<div gridTemplateColumns: layout?.gridTemplateColumns,
key={att.id} gridTemplateRows: layout?.gridTemplateRows,
className="relative overflow-hidden" }}
style={ >
tile {visible.map((att, i) => {
? { const isLastSlot = i === MAX_VISIBLE - 1 && extra > 0;
gridColumn: `${tile.colStart} / ${tile.colEnd}`, const tile = layout?.tiles[i];
gridRow: `${tile.rowStart} / ${tile.rowEnd}`, return (
} <div
: undefined key={att.id}
} className="relative overflow-hidden"
> style={
<button tile
type="button" ? {
onClick={() => openLightbox(images, i, text, post.id)} gridColumn: `${tile.colStart} / ${tile.colEnd}`,
className="group block h-full w-full" gridRow: `${tile.rowStart} / ${tile.rowEnd}`,
aria-label={ }
isLastSlot ? `View all ${images.length} images` : "View image" : undefined
} }
> >
<BubbleImage <button
src={sources[i]} type="button"
fallbackSrc={[att.thumbUrl, att.url]} onClick={() => openLightbox(images, i, text, post.id)}
loading="lazy" className="group block h-full w-full"
className="h-full w-full object-cover transition duration-300 group-hover:scale-[1.03]" aria-label={
/> isLastSlot
{isLastSlot ? ( ? `View all ${images.length} images`
<div className="absolute inset-0 flex flex-col items-center justify-center gap-0.5 bg-black/60 text-white backdrop-blur-[1px] transition group-hover:bg-black/50"> : "View image"
<span className="text-3xl font-bold leading-none md:text-4xl"> }
+{extra} >
</span> <BubbleImage
</div> src={sources[i]}
fallbackSrc={[att.thumbUrl, att.url]}
loading="lazy"
className="h-full w-full object-cover transition duration-300 group-hover:scale-[1.03]"
/>
{isLastSlot ? (
<div className="absolute inset-0 flex flex-col items-center justify-center gap-0.5 bg-black/60 text-white backdrop-blur-[1px] transition group-hover:bg-black/50">
<span className="text-3xl font-bold leading-none md:text-4xl">
+{extra}
</span>
</div>
) : null}
</button>
{!isLastSlot ? (
<AttachmentDownloadPill postId={post.id} attachment={att} />
) : null} ) : null}
</button> </div>
{!isLastSlot ? ( );
<AttachmentDownloadPill postId={post.id} attachment={att} /> })}
) : null} </div>
</div>
);
})}
</div> </div>
{text ? ( {text ? (
<div className="message-stream-copyable-text select-text whitespace-pre-wrap break-words px-4 pt-3 text-[14px] leading-6 text-neutral-100"> <div className="message-stream-copyable-text select-text whitespace-pre-wrap break-words px-4 pt-3 text-[14px] leading-6 text-neutral-100">