diff --git a/apps/www/components/LaunchWeek/14/TicketCopy.tsx b/apps/www/components/LaunchWeek/14/TicketCopy.tsx index 39f88470b3b..3ae8d2fb59d 100644 --- a/apps/www/components/LaunchWeek/14/TicketCopy.tsx +++ b/apps/www/components/LaunchWeek/14/TicketCopy.tsx @@ -9,8 +9,8 @@ export default function TicketCopy() { const { username } = userData const [copied, setCopied] = useState(false) const buttonRef = useRef(null) - const displayUrl = `.../launch-week?referal=${username}` - const link = `${LW14_URL}?referal=${username}` + const displayUrl = `.../launch-week/tickets/${username}` + const link = `${LW14_URL}/tickets/${username}` return ( - - - - - - - - - - - + + + + ) } -export const getStaticProps: GetStaticProps = async ({ params }) => { - const username = params?.username?.toString() || null - let user - - const supabaseAdmin = createClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.LIVE_SUPABASE_COM_SERVICE_ROLE_KEY! - ) - - // fetch the normal ticket - // stores the og images in supabase storage - fetch(`${SITE_ORIGIN}/api-v2/ticket-og?username=${encodeURIComponent(username ?? '')}`) - - // fetch a specific user - if (username) { - const { data } = await supabaseAdmin! - .from('tickets_view') - .select('name, username, ticket_number, metadata, platinum, secret, role, company, location') - .eq('launch_week', 'lw13') - .eq('username', username) - .single() - - user = data - } - - // fetch the platinum ticket - // stores the og images in supabase storage - if (user?.secret) { - fetch( - `${SITE_ORIGIN}/api-v2/ticket-og?username=${encodeURIComponent(username ?? '')}&secret=true` - ) - } else if (user?.platinum) { - // fetch /api-v2/ticket-og - fetch( - `${SITE_ORIGIN}/api-v2/ticket-og?username=${encodeURIComponent(username ?? '')}&platinum=true` - ) - } - - const ticketType = user?.secret ? 'secret' : user?.platinum ? 'platinum' : 'regular' - const ogImageUrl = `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/object/public/images/launch-week/lw13/og/${ticketType}/${username}.png?t=${dayjs(new Date()).format('DHHmmss')}` - - return { - props: { - user: { - ...user, - username, - }, - ogImageUrl, - key: username, - }, - revalidate: 5, - } -} - -export const getStaticPaths: GetStaticPaths = async () => { - return Promise.resolve({ - paths: [], - fallback: 'blocking', - }) -} +export default Lw14Page