Merge pull request #13299 from supabase/fs/lw7-copy

chore: update sharing experience
This commit is contained in:
Francesco Sansalvadore authored and GitHub committed 2023-03-30 00:24:27 +02:00
commit 0af4defce6
10 files changed
+9 -77

No files matched your search

@@ -109,7 +109,7 @@ export default function LaunchWeekPrizeSection({ className }: { className?: stri
animateFrom="down"
content={
<h3 className="text-sm flex items-center gap-4">
Launch Week 7 Limited Edition Sticker Pack <LabelBadge text="25 packs" />
Supabase Sticker Pack <LabelBadge text="25 packs" />
</h3>
}
/>
@@ -3,7 +3,6 @@ import React from 'react'
import { Button } from 'ui'
import { useMobileViewport } from '../../../hooks/useMobileViewport'
import { UserData } from '../Ticket/hooks/use-conf-data'
import { TicketBrickWallRow } from './TicketBrickWallRow'
import { TicketBrickWallSlider } from './TicketBrickWallSlider'
type user = UserData
@@ -1,54 +0,0 @@
import { useRef } from 'react'
import Image from 'next/image'
import Link from 'next/link'
import { motion, useScroll, useTransform } from 'framer-motion'
import { UserData } from '../Ticket/hooks/use-conf-data'
import { useMobileViewport } from '../../../hooks/useMobileViewport'
interface Props {
users: UserData[]
reverse?: boolean
xOffset?: number
}
export function TicketBrickWallRow({ users, reverse, xOffset = 250 }: Props) {
const ref = useRef(null)
const isMobile = useMobileViewport(768)
const { scrollYProgress } = useScroll({
target: ref,
offset: ['start end', 'end start'],
})
const STORAGE_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw7'
const BUCKET_FOLDER_VERSION = 'v3'
const getOgUrl = (username: string, isGold: boolean) =>
`${STORAGE_URL}/tickets/gallery/${
isGold ? 'golden' : 'regular'
}/${BUCKET_FOLDER_VERSION}/${username}.png`
const x = useTransform(scrollYProgress, [0, 1], reverse ? [-xOffset, 0] : [0, -xOffset])
return (
<div ref={ref} className="relative h-[125px] md:h-[250px] w-full m-0 overflow-hidden py-2.5">
<div className="absolute flex h-fit w-fit">
<motion.div className="flex gap-2.5 md:gap-5 will-change-transform" style={{ x }}>
{users.map((user, i) => (
<Link href={`/launch-week/tickets/${user.username}`} key={user.username}>
<a className="relative w-[230px] md:w-[450px] rounded-lg md:rounded-2xl overflow-hidden transform scale-100 md:hover:scale-[101%] transition-transform">
<div className="relative inset-0 w-full pt-[50%] transform scale-[120%]">
<Image
src={getOgUrl(user.username!, !!user.golden)}
alt={user.username}
layout="fill"
objectFit="cover"
objectPosition={isMobile ? 'top 50% right 2px' : 'top 50% right 5px'}
placeholder="blur"
blurDataURL="/images/blur.png"
/>
</div>
</a>
</Link>
))}
</motion.div>
</div>
</div>
)
}
@@ -137,8 +137,8 @@ export default function Ticket({
<>
{golden ? (
<p>
You got a Golden ticket. This means you're in, and you also won a Supabase
sticker pack!
Join us on April 16th for Launch Week 7's final day and find out if you are one
of the lucky winners.
</p>
) : username ? (
<p>
@@ -1,15 +1,11 @@
import { useState, useRef, useEffect } from 'react'
import { useRouter } from 'next/router'
// import { scrollTo } from '@lib/smooth-scroll';
import cn from 'classnames'
// import GithubIcon from '~/components/LaunchWeek/Ticket/icons/icon-github'
// import CheckIcon from '~/components/LaunchWeek/Ticket/icons/icon-check'
import { SITE_ORIGIN } from '~/lib/constants'
import useConfData from '~/components/LaunchWeek/Ticket//hooks/use-conf-data'
import LoadingDots from './loading-dots'
import formStyles from './form.module.css'
import ticketFormStyles from './ticket-form.module.css'
import { Button, IconCheck, IconCheckCircle, IconLoader } from 'ui'
import { Button, IconCheckCircle, IconLoader } from 'ui'
type FormState = 'default' | 'loading' | 'error'
type TicketGenerationState = 'default' | 'loading'
@@ -1,13 +1,11 @@
import { useState, useCallback, useEffect } from 'react'
import { useState, useCallback } from 'react'
import cn from 'classnames'
import useConfData from '~/components/LaunchWeek/Ticket/hooks/use-conf-data'
import { useRouter } from 'next/router'
import LoadingDots from './loading-dots'
import styleUtils from './utils.module.css'
import styles from './form.module.css'
import useEmailQueryParam from '~/components/LaunchWeek/Ticket/hooks/use-email-query-param'
import { IconLoader } from '~/../../packages/ui'
// import Captcha, { useCaptcha } from './captcha'
type FormState = 'default' | 'loading' | 'error'
@@ -15,7 +15,7 @@ export default function TicketCopy({ username }: Props) {
const [copied, setCopied] = useState(false)
const scrollRef = useRef<HTMLParagraphElement>(null)
const buttonRef = useRef<HTMLButtonElement>(null)
const url = `${SITE_URL}/tickets/${username}`
const url = `${SITE_URL}/tickets/${username}?lw=7`
useEffect(() => {
if (navigator.clipboard) {
setCopyEnabled(true)
+1 -1
View File
@@ -27,7 +27,7 @@
"url": "/pricing"
},
{
"text": "Launch Week 6",
"text": "Launch Week 7",
"url": "/launch-week"
}
]
-2
View File
@@ -147,8 +147,6 @@ export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
.order('createdAt', { ascending: false })
.limit(17)
// res.setHeader('Cache-Control', 'public, s-maxage=10, stale-while-revalidate=59')
return {
props: {
users,
@@ -30,10 +30,8 @@ const supabaseAdmin = createClient(
export default function UsernamePage({ user, users, ogImageUrl }: Props) {
const { username, ticketNumber, name, golden, referrals, bg_image_id } = user
const TITLE = `${
name ? name + '’s' : 'Get your'
} #SupaLaunchWeek Ticket | Share to win some fantastic swag`
const DESCRIPTION = 'Supabase Launch Week 7 | 10–14 April 2023'
const TITLE = `${name ? name + '’s' : 'Get your'} #SupaLaunchWeek Ticket`
const DESCRIPTION = 'Supabase Launch Week 7 | 10–14 April 2023 | Generate your ticket. Win swag.'
const OG_URL = `${SITE_URL}/tickets/${username}`
const [supabase] = useState(() =>
@@ -133,9 +131,6 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
ogImageUrl = `https://obuldanrptloktxcffvn.functions.supabase.co/lw7-ticket-og?username=${encodeURIComponent(
username ?? ''
)}${golden ? '&golden=true' : ''}`
// ogImageUrl = `https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw7/tickets/${
// golden ? 'golden' : 'regular'
// }/v3/${username ?? ''}.png`
}
return {