import { useI18n } from "../../../i18n"; import type { Post } from "../../../types/post"; import { AttachmentDownloadPill } from "../AttachmentDownloadPill"; import { BubbleImage } from "../BubbleImage"; import { useLightbox } from "../overlays/ImageLightbox"; import { autolink } from "../utils/autolink"; import { postDisplayText } from "../utils/postText"; const MAX_VISIBLE = 4; function albumGridClass(count: number) { const height = "h-[230px] min-[440px]:h-[250px] md:h-[300px] lg:h-[340px]"; if (count === 2) return `${height} grid grid-cols-1 grid-rows-2`; return `${height} grid grid-cols-2 grid-rows-2`; } function albumItemClass(index: number, count: number) { if (count === 3 && index === 0) return "row-span-2"; return ""; } export function AlbumBubble({ post }: { post: Post }) { const { openLightbox } = useLightbox(); const { lang } = useI18n(); const images = post.attachments; const text = postDisplayText(post, lang); const visible = images.slice(0, MAX_VISIBLE); const extra = images.length - MAX_VISIBLE; const layoutCount = Math.min(images.length, MAX_VISIBLE); return (