Files
supabase/apps/www/components/LaunchWeek/8/TicketsGrid.tsx
T
Francesco SansalvadoreandJonathan Summers-Muir 7c8ac579a4 Feat x (#19250)
* make dark: selector work again

* create new LWX page and move previous to lw8 folder

* set up initial sign in with github flow

* set up ticket layout

* clean up TicketForm

* connect to lwx_tickets table and sign in with github

* update landing page content

* ticket layout

* share actions

* add prize section

* fix lw7 types

* fix lw7 types

* update content

* update realtime icon color

* lwx og ticket

* cleanup

* fix types in previous lw

* fix ticket copy icon
gst

* add lwx Promo banners

* golden ticket

* lwx-ticket-og

* update announcement banner

* update

* update colors

* update swag prize

* add padding to keyboard image

* update text
gst

* update ticket bg and countdown colons

* clean up

* update lwx cta color

* update functions

* platinum

* update og

* update og

* add og image and update supabase logo

* add ticket customization form

* update meta description

* fix import

* fix import

* bg

* fix realtime

* add hover interaction on lwx shape

* svg loader

* setTimeout on window.open to fix safari

* eager load ticket assets

* eager load background

* use next/link for ticketActions

* design PromoToast

* promoToast in docs

* fix referral link

* fix stuff

* update og functions

* update og functions

* update PT timezone shift

* update ticketing flow layout

* update ticketing flow layout

* prefetch right user link

* toggle ticket customization form

* update og regular bg

* remove lwx title when ticket

* remove edit button on ticket in share page

* optimize og generation function

* asd

* fix www announcement banner

* spacing

* center share link

* update mobile ticket bg

* maybe add logic to hide presence if low traffic

* add lwx favicon

* truncate shareable url

* fix keyboard image ratio

* update discount copywriting

* add keyboard controls to customization form

* update lwx favicon

* update lwx favicon

* update FaviconImports

* update tickets page

* stickers

* Revert "stickers"

This reverts commit d7d7d9beb9.

* update lockfile to fix turbo darwin 64 bug

* stickers

* make x always visible on mobile

* format favicon manifest

* update social sharing text

* fix typo

* update social share text

* remove window.open

* update promo toast info

---------

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
2023-11-28 16:31:14 +01:00

102 lines
3.7 KiB
TypeScript

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 BUCKET_FOLDER_VERSION = 'v1'
const getTicketImageUrl = (username: string, isGold: boolean) =>
`${STORAGE_URL}/tickets/${
isGold ? 'golden' : 'regular'
}/${BUCKET_FOLDER_VERSION}/${username}.png`
const isMobile = useBreakpoint(1024)
const isTablet = useBreakpoint(1280)
const horizontalOffset = isMobile ? 8 : 20
return (
<div
className={['grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 py-12 relative'].join(' ')}
>
{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/8/lw8-ticket-empty.jpg'
return (
<Link
href={`/launch-week/8/tickets/${user.username}`}
key={`${user.username}-000${i}`}
onClick={() => window.scrollTo(0, 0)}
legacyBehavior
passHref
>
<motion.a
className="relative w-full p-[1px] rounded-lg sm:rounded-xl overflow-hidden hover:cursor-pointer bg-gradient-to-b from-[#58585860] to-[#ffffff10]"
initial={{
opacity: 0,
y: 20,
x: isOddRow ? horizontalOffset : -horizontalOffset,
}}
animate={{
opacity: 1,
y: 0,
x: isOddRow ? horizontalOffset : -horizontalOffset,
transition: {
duration: 0.4,
ease: [0.24, 0.25, 0.05, 1],
delay: recalculatedDelay,
},
}}
>
<div className="relative inset-0 w-full pt-[50%] bg-[#2f2e2e] overflow-hidden rounded-lg sm:rounded-xl">
<Image
src={imgUrl}
alt={user.username ?? ''}
fill
className="object-cover object-center"
placeholder="blur"
blurDataURL="/images/launchweek/8/lw8-ticket-empty.jpg"
/>
</div>
</motion.a>
</Link>
)
})}
{isLoading &&
Array.from({ length: pageCount }, (_, i) => (
<motion.div
className="relative rounded-lg sm:rounded-xl overflow-hidden h-0 w-full pt-[50%]"
initial={{ opacity: 0, y: 20 }}
animate={{
opacity: 1,
y: 0,
transition: {
duration: 0.4,
ease: [0.24, 0.25, 0.05, 1],
delay: i / 15,
},
}}
>
<div className="absolute inset-0 rounded-lg sm:rounded-xl bg-gradient-to-b from-[#1c1c1c] to-[#121212] p-[1px] overflow-hidden">
<div className="absolute inset-[1px] rounded-lg sm:rounded-xl bg-gradient-to-b from-[#1c1c1c] to-[#121212]" />
</div>
</motion.div>
))}
</div>
)
}