From 46a02aad075aa32d606afe2d47fa369f9c05b490 Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Mon, 6 Mar 2023 17:04:55 -0330 Subject: [PATCH] Grab a random image for the ticket bg --- .../LaunchWeek/Ticket/TicketVisual.tsx | 27 ++++++++++++++++--- apps/www/pages/launch-week/index.tsx | 2 +- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/www/components/LaunchWeek/Ticket/TicketVisual.tsx b/apps/www/components/LaunchWeek/Ticket/TicketVisual.tsx index 01359b0d930..40200e9b875 100644 --- a/apps/www/components/LaunchWeek/Ticket/TicketVisual.tsx +++ b/apps/www/components/LaunchWeek/Ticket/TicketVisual.tsx @@ -2,13 +2,13 @@ import styles from './ticket-visual.module.css' import TicketProfile from './TicketProfile' import TicketNumber from './TicketNumber' import TicketMono from './ticket-mono' -import TicketInfoFooter from './ticket-info-footer' import TicketMonoMobile from './ticket-mono-mobile' -import cn from 'classnames' import { useRouter } from 'next/router' -import { DATE } from '~/lib/constants' import useConfData from '~/components/LaunchWeek/Ticket/hooks/use-conf-data' import TicketHeader from './TicketHeader' +import { useState } from 'react' +import { SupabaseClient } from '@supabase/supabase-js' +import Image from 'next/image' type TicketGenerationState = 'default' | 'loading' type Props = { @@ -35,6 +35,11 @@ export default function TicketVisual({ const router = useRouter() const basePath = router.basePath + const [supabase, setSupabase] = useState(null) + const [imageIsLoading, setImageIsLoading] = useState(true) + const randomNumber = Math.floor(Math.random() * 200) + 1 + const goldRandomNumber = Math.floor(Math.random() * 56) + 1 + const storageBaseFilepath = `https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw7/tickets_bg/` return (
+
+ setImageIsLoading(false)} + /> +
{username && }