/* eslint-disable bsky-internal/avoid-unwrapped-text */ import React from 'react' import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api' import {Butterfly} from './Butterfly.js' import {Img} from './Img.js' export const STARTERPACK_HEIGHT = 630 export const STARTERPACK_WIDTH = 1200 export const TILE_SIZE = STARTERPACK_HEIGHT / 3 const GRADIENT_TOP = '#0A7AFF' const GRADIENT_BOTTOM = '#59B9FF' const IMAGE_STROKE = '#359CFF' export function StarterPack(props: { starterPack: AppBskyGraphDefs.StarterPackView images: Map }) { const {starterPack, images} = props const record = AppBskyGraphStarterpack.isRecord(starterPack.record) ? starterPack.record : null const imagesArray = [...images.values()] const imageOfCreator = images.get(starterPack.creator.did) const imagesExceptCreator = [...images.entries()] .filter(([did]) => did !== starterPack.creator.did) .map(([, image]) => image) const imagesAcross: Buffer[] = [] if (imageOfCreator) { if (imagesExceptCreator.length >= 6) { imagesAcross.push(...imagesExceptCreator.slice(0, 3)) imagesAcross.push(imageOfCreator) imagesAcross.push(...imagesExceptCreator.slice(3, 6)) } else { const firstHalf = Math.floor(imagesExceptCreator.length / 2) imagesAcross.push(...imagesExceptCreator.slice(0, firstHalf)) imagesAcross.push(imageOfCreator) imagesAcross.push( ...imagesExceptCreator.slice(firstHalf, imagesExceptCreator.length), ) } } else { imagesAcross.push(...imagesExceptCreator.slice(0, 7)) } return (
{/* image tiles */}
{[...Array(18)].map((_, i) => { const image = imagesArray.at(i % imagesArray.length) return (
{image && }
) })} {/* background overlay */}
{/* foreground text & images */}
JOIN THE CONVERSATION
{imagesAcross.map((image, i) => { return (
) })}
{record?.name || 'Starter Pack'}
on Bluesky
) }