import { motion } from 'framer-motion' import Image from 'next/image' import Link from 'next/link' import { useBreakpoint } from 'common/hooks/useBreakpoint' import { UserData } from '../hooks/use-conf-data' interface Props { loadedUsers: UserData[] isLoading: boolean pageCount: number offset: number } export default function TicketsGrid({ loadedUsers, isLoading, pageCount, offset }: Props) { const STORAGE_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lwx' const getTicketImageUrl = (username: string, isGold: boolean) => `${STORAGE_URL}/tickets/${isGold ? 'platinum' : 'regular'}/${username}.png` const isMobile = useBreakpoint(1024) const isTablet = useBreakpoint(1280) const horizontalOffset = isMobile ? 8 : 20 return (
{loadedUsers?.map((user, i) => { const rowTickets = isMobile ? 2 : isTablet ? 3 : 4 const divider = Math.floor(i / rowTickets) const isOddRow = divider % 2 === 0 // Delay should be no more than pageCount for new loaded users const recalculatedDelay = i >= pageCount * 2 ? (i - pageCount * (offset - 1)) / 15 : i / 15 const imgUrl = getTicketImageUrl(user.username!, !!user.golden) ?? '/images/launchweek/lwx/tickets/placeholder.png' return ( window.scrollTo(0, 0)} legacyBehavior passHref >
{user.username
) })} {isLoading && Array.from({ length: pageCount }, (_, i) => (
))}
) }