Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

lw7: finish community lw tickets page

Francesco Sansalvadore4606c957f930
diff --git a/apps/www/components/LaunchWeek/LaunchSection/LaunchWeekPrizeSection.tsx b/apps/www/components/LaunchWeek/LaunchSection/LaunchWeekPrizeSection.tsx
index 55738c55a96..e78a04ed79e 100644
--- a/apps/www/components/LaunchWeek/LaunchSection/LaunchWeekPrizeSection.tsx
+++ b/apps/www/components/LaunchWeek/LaunchSection/LaunchWeekPrizeSection.tsx
@@ -50,8 +50,8 @@ export default function LaunchWeekPrizeSection({ className }: { className?: stri
Get your <span className="gradient-text-pink-500">winning ticket</span>
</h2>
<p className="radial-gradient-text-scale-500">
- Mark your calendars for April 9th and join us on Discord for Launch Week 7's final day
- to find out if you're one of the lucky winners. Get sharing!
+ Mark your calendars for April 16th and join us on Discord for Launch Week 7's final
+ day to find out if you're one of the lucky winners. Get sharing!
</p>
</motion.div>
</div>
diff --git a/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx b/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx
new file mode 100644
index 00000000000..323fb1a931e
--- /dev/null
+++ b/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx
@@ -0,0 +1,66 @@
+import { motion } from 'framer-motion'
+import Image from 'next/image'
+import Link from 'next/link'
+import { useMobileViewport } from '../../../hooks/useMobileViewport'
+import styles from './tickets-grid.module.css'
+
+interface Props {
+ loadedUsers: any[]
+ isLoading: boolean
+}
+
+export default function TicketsGrid({ loadedUsers, isLoading }: Props) {
+ const STORAGE_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw7'
+ const getOgUrl = (username: string) => `${STORAGE_URL}/tickets/gallery/${username}.png`
+ const isMobile = useMobileViewport(768)
+ const isTablet = useMobileViewport(1024)
+
+ return (
+ <div
+ className={[
+ 'grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 mx-[-10vw] gap-3 py-12 relative',
+ styles['tickets-grid'],
+ ].join(' ')}
+ >
+ {loadedUsers?.map((user, i) => {
+ const rowTickets = isMobile ? 2 : isTablet ? 3 : 5
+ const divider = Math.floor(i / rowTickets)
+ const isOddRow = divider % 2 === 0
+
+ return (
+ <Link href={`/launch-week/tickets/${user.username}`} key={`${user.username}-000${i}`}>
+ <motion.a
+ className="relative w-full rounded-lg overflow-hidden transform scale-100 md:hover:scale-[101%]"
+ initial={{ opacity: 0, y: 20, x: isOddRow ? 30 : -30 }}
+ animate={{
+ opacity: !isTablet && (i === 0 || i === 4) ? 0 : 1,
+ y: 0,
+ x: isOddRow ? 30 : -30,
+ transition: {
+ duration: 0.4,
+ ease: [0.24, 0.25, 0.05, 1],
+ delay: i / 15,
+ },
+ }}
+ >
+ <div className="relative inset-0 w-full pt-[50%] transform">
+ <Image
+ src={getOgUrl(user.username!)}
+ alt={user.username}
+ layout="fill"
+ objectFit="cover"
+ quality={50}
+ objectPosition="center"
+ placeholder="blur"
+ blurDataURL="/images/blur.png"
+ />
+ </div>
+ </motion.a>
+ </Link>
+ )
+ })}
+ {/* TODO: Add PAGE_COUNT length skeleton loaders when loading */}
+ {isLoading && <div className="relative rounded-lg bg-slate-100 h-0 w-full pt-[50%]" />}
+ </div>
+ )
+}
diff --git a/apps/www/components/LaunchWeek/Ticket/tickets-grid.module.css b/apps/www/components/LaunchWeek/Ticket/tickets-grid.module.css
new file mode 100644
index 00000000000..94067d939d6
--- /dev/null
+++ b/apps/www/components/LaunchWeek/Ticket/tickets-grid.module.css
@@ -0,0 +1,4 @@
+.tickets-grid {
+ grid-template-rows: masonry;
+ masonry-auto-flow: ordered;
+}
diff --git a/apps/www/pages/launch-week/tickets/index.tsx b/apps/www/pages/launch-week/tickets/index.tsx
index 01825df61ff..f36ea84c9ab 100644
--- a/apps/www/pages/launch-week/tickets/index.tsx
+++ b/apps/www/pages/launch-week/tickets/index.tsx
@@ -10,9 +10,8 @@ import { motion } from 'framer-motion'
import { UserData } from '~/components/LaunchWeek/Ticket/hooks/use-conf-data'
import LW7BgGraphic from '../../../components/LaunchWeek/LW7BgGraphic'
import CTABanner from '../../../components/CTABanner'
-import Link from 'next/link'
-import Image from 'next/image'
import { debounce } from 'lodash'
+import TicketsGrid from '../../../components/LaunchWeek/Ticket/TicketsGrid'
interface Props {
users: UserData[]
@@ -45,7 +44,7 @@ const loadUsers = async (offset = 0, pageCount: number) => {
export default function TicketsPage({ users }: Props) {
const ref = useRef(null)
- const PAGE_COUNT = 10
+ const PAGE_COUNT = 20
const STORAGE_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw7'
const description = 'Supabase Launch Week 7 | 3-7 April 2023'
const [isLoading, setIsLoading] = useState(false)
@@ -77,7 +76,7 @@ export default function TicketsPage({ users }: Props) {
const isBottomInView = () => {
if (ref.current && window) {
- const rect = ref.current.getBoundingClientRect()
+ const rect = (ref.current as HTMLDivElement)?.getBoundingClientRect()
const isInView = rect.bottom <= (window.innerHeight || document.documentElement.clientHeight)
setHasLoaded((prev) => !prev && isInView)
}
@@ -94,6 +93,8 @@ export default function TicketsPage({ users }: Props) {
}
}, [])
+ const finalAnimationState = { y: 0, opacity: 1 }
+
return (
<>
<NextSeo
@@ -120,44 +121,26 @@ export default function TicketsPage({ users }: Props) {
</div>
<div className="bg-lw7-gradient absolute inset-0 z-0" />
</div>
- <SectionContainer className="z-10 -mt-20 md:-mt-60">
- <div ref={ref} className="grid grid-cols-3 gap-3 py-12 relative">
- {loadedUsers?.map((user, i) => (
- <Link
- href={`/launch-week/tickets/${user.username}`}
- key={`${user.username}-000${i}`}
- >
- <motion.a
- className="relative w-full rounded-lg overflow-hidden transform scale-100 md:hover:scale-[101%]"
- 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="relative inset-0 w-full pt-[50%] transform">
- <Image
- src={getOgUrl(user.username!, !!user.golden)}
- alt={user.username}
- layout="fill"
- objectFit="cover"
- objectPosition="center"
- placeholder="blur"
- blurDataURL="/images/blur.png"
- />
- </div>
- </motion.a>
- </Link>
- ))}
- {/* TODO: Add PAGE_COUNT length skeleton loaders when loading */}
- {isLoading && (
- <div className="relative rounded-lg bg-slate-100 h-0 w-full pt-[50%]" />
- )}
+ <SectionContainer className="z-10 -mt-60 md:-mt-[500px] max-w-none overflow-hidden">
+ <div className="text-center relative z-10 text-white">
+ <motion.div
+ className="max-w-[38rem] mx-auto px-4 flex flex-col items-center gap-4"
+ initial={{ y: -20, opacity: 0 }}
+ whileInView={finalAnimationState}
+ viewport={{ once: true, margin: '-150px' }}
+ transition={{ type: 'spring', bounce: 0, delay: 0.2 }}
+ >
+ <h2 className="text-4xl">
+ Check out <span className="gradient-text-pink-500">all the tickets</span>
+ </h2>
+ <p className="radial-gradient-text-scale-500">
+ Mark your calendars for April 16th and join us on Discord for Launch Week 7's
+ final day to find out if you're one of the lucky winners. Get sharing!
+ </p>
+ </motion.div>
+ </div>
+ <div ref={ref}>
+ <TicketsGrid loadedUsers={loadedUsers} isLoading={isLoading} />
</div>
</SectionContainer>
</div>
@@ -172,7 +155,7 @@ export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
.from('lw7_tickets_golden')
.select('*')
.order('createdAt', { ascending: false })
- .limit(6)
+ .limit(20)
return {
props: {