Files
supabase/apps/www/components/LaunchWeek/13/Ticket/TicketingFlow.tsx
94e919d417 lw14 ticketing #34444
* mamba init

* shader-updates

* feat: add better bloom

* cleanup

* Fix GLTF model loading to respect original material properties

Signed-off-by: Piotr Goszczyński <pg@tonik.com>

* Fix GLTF model loading to respect original material properties

Signed-off-by: Piotr Goszczyński <pg@tonik.com>

* stash changes

* Update font to Arial in mamba ticket component

Signed-off-by: Piotr Goszczyński <pg@tonik.com>

* Fix wireframe size in debug mode

Signed-off-by: Piotr Goszczyński <pg@tonik.com>

* Fix wireframe size in debug mode by attaching to child mesh instead of model

Signed-off-by: Piotr Goszczyński <pg@tonik.com>

* fix scaling

* fix

* feat: load png with color material

* fix: spline material

* add toggling of effects

* stash

* feat: ticket model

* load better model

* strcture

* fix rotation speed

* rotation

* fix rotation

* new model

* prepare final designs

* add color palette

* feat: add fonts and rendering

* render dynamic texture

* load all textures

* fix: color sace

* feat: secret model

* improve perf

* postprocessing

* fix: output pass

* improve shaders

* increase glitches

* cleanup

* update colors

* remove unused files

* add header

* feat: ui

* fix: raycaster

* feat: add button toggling

* Improve ui

* fix corners positoins

* add tunnel effect

* fix: dates

* add dynamic rocket position rendering

* add different logs

* feat: add migrations and connect to real data

* chore: state cleanup to use reducer

Migrate logic to centralized reducer for ease of debugging

* feat: add hud layout

* add grain effect to hud

* limit glitching, move page to main url

* add vignette effect

* fix: desktop layout

* remove vertical space

* feat: save secret state on ticket upgrade

* feat: make platinum version take priority over secret

* add mobile header

* remove unnecessary allocations

* fix: resize hud

* add page scaling for mobile layouts

* add ticket scaling based on resolution

* adjust mobile styles

* fix: resize texture distortion

* add gauges mobile breaking points

* feat: mobile claim layout

* mobile styles

* Show ticket referer

* rename files

* update copy links

* add partymode part 1

* feat: og images, lw14

* add presence tracking

* add live updates of guages

* Update meetups label

* update label

* username ticket lw14

* add proper subscription on first render

* remove green edge

* feat: remove species & planet from ticket scene

* change urls

* feat/mamba-assets: update assets

* feat: fix shader grain

* add color to shader

* remove vertical space

* fix: og image generation

* fix referal and removing of access token

* make urls nicer

* feat/mamba-assets: dynamic line break + dynamic background

* small adjustments

* add trimming to ogimages

* minor: missing font file

* fix og image line wrapping

* remove dot from meetups

* improve ticket quality

* upss, forgot to commit one file

* feat add dynamic og image linking

* update static site url

* fix low mobile resolution

* add banners

* simplify banner loading

* add missing fonts

* fix name breaking to prioritize spaces

* update quality based on devicePixelRatio

* fix button positioning

* revert: feature flags disabling

* update start date

* limit shader effects and disable axis, potential fix to chrome freeze

* feat: init mamba 01

* create narrow ticket scene

* narrow scene for ticket and fix follow mouse

* fix dates

* alternative version

* updated ticket page

* remove migrations

* remove files

* prettier

* prettier

* Fix TS and prettier issues

* Fix TS issues

* Test

* Remove console log

* fix updating ticket on share

* chore: lw cleanup

* fix ticket layout

* fix chrome crashes

* lower crt intensity

* tunnel improvements

* fix tunnel effect

* chore: z-index and prettier fix

* chore: padding

* fix double tunnel

* chore: font on banners

---------

Signed-off-by: Piotr Goszczyński <pg@tonik.com>
Co-authored-by: dztonik <dz@tonik.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
2025-03-27 15:55:47 +00:00

169 lines
7.6 KiB
TypeScript

import { AnimatePresence, LazyMotion, domAnimation, m } from 'framer-motion'
import { cn } from 'ui'
import { DEFAULT_TRANSITION, INITIAL_BOTTOM, getAnimation } from '~/lib/animations'
import { LW13_DATE } from '~/lib/constants'
import CanvasSingleMode from '~/components/LaunchWeek/13/Multiplayer/CanvasSingleMode'
import ThreeTicketCanvas from '~/components/LaunchWeek/13/ThreeTicketCanvas'
import useConfData from '~/components/LaunchWeek/hooks/use-conf-data'
import useWinningChances from '~/components/LaunchWeek/hooks/useWinningChances'
import SectionContainer from '~/components/Layouts/SectionContainer'
import TicketForm from '~/components/LaunchWeek/13/Ticket/TicketForm'
import TicketSwagCtaBox from '~/components/LaunchWeek/13/Ticket/TicketSwagCtaBox'
import TicketPresence from './TicketPresence'
const TicketingFlow = () => {
const { ticketState, userData } = useConfData()
const isLoading = ticketState === 'loading'
const isRegistering = ticketState === 'registration'
const hasTicket = ticketState === 'ticket'
const hasPlatinumTicket = userData.platinum
const hasSecretTicket = userData.secret
const ticketType = hasSecretTicket ? 'secret' : hasPlatinumTicket ? 'platinum' : 'regular'
const transition = DEFAULT_TRANSITION
const initial = INITIAL_BOTTOM
const animate = getAnimation({ duration: 1 })
const exit = { opacity: 0, transition: { ...transition, duration: 0.2 } }
const winningChances = useWinningChances()
const DISPLAY_NAME = userData?.name || userData?.username
const FIRST_NAME = DISPLAY_NAME?.split(' ')[0]
return (
<>
<SectionContainer className="relative h-full lg:min-h-[600px] lg:max-h-[600px] flex-1 pointer-events-none">
<div className="relative z-10 flex items-center h-full">
<h1 className="sr-only">Supabase Launch Week 13 | {LW13_DATE}</h1>
<LazyMotion features={domAnimation}>
<AnimatePresence mode="wait" key={ticketState}>
{isLoading && (
<m.div
key="loading"
initial={exit}
animate={animate}
exit={exit}
className="relative w-full lg:min-h-[400px] max-h-[400px] mx-auto py-16 md:py-24 flex flex-col items-center gap-6 text-foreground"
>
<div className="hidden">
<TicketForm />
</div>
<svg
className="animate-spinner opacity-50 w-5 h-5 md:w-6 md:h-6"
width="100%"
height="100%"
viewBox="0 0 62 61"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M61 31C61 14.4315 47.5685 1 31 1C14.4315 1 1 14.4315 1 31"
stroke="white"
strokeWidth="2"
/>
</svg>
</m.div>
)}
{isRegistering && (
<m.div
key="registration"
initial={initial}
animate={animate}
exit={exit}
className={cn(
'mx-auto w-full max-w-4xl lg:min-h-[400px] max-h-[400px] h-full text-left grid md:grid-cols-2 justify-center gap-8 xl:gap-24 opacity-0 invisible',
!hasTicket && 'opacity-100 visible',
'justify-items-end'
)}
>
<div className="h-full w-full max-w-xs md:max-w-none flex flex-col justify-center gap-2 md:gap-6">
<div className="flex flex-col gap-2 md:gap-6">
<div className="flex flex-col flex-wrap gap-0">
<h2 className="text-foreground uppercase tracking-wider text-2xl">
Launch Week 13
</h2>
<p className="text-foreground-lighter uppercase tracking-wider text-xl md:text-2xl">
{LW13_DATE}
</p>
</div>
<div className="flex flex-col gap-2 text-foreground-lighter text-sm xl:text-base">
You can still claim a ticket thoughout the week.
</div>
<div className="flex flex-col md:flex-row gap-4 mt-2 md:mt-0 items-start md:items-center">
<TicketPresence className="opacity-0 invisible translate-y-1 transition-all" />
</div>
</div>
</div>
<div className="h-full min-h-[400px] aspect-[0.8/1] rounded-lg border border-dashed border-strong flex items-center justify-center bg-surface-75/25 backdrop-blur-xl">
<TicketForm />
</div>
</m.div>
)}
{hasTicket && (
<m.div
key="ticket"
initial={initial}
animate={animate}
exit={exit}
className="w-full max-w-5xl mx-auto lg:min-h-[400px] xl:pl-8 h-full flex flex-col lg:flex-row items-center lg:justify-start gap-8 md:gap-10 lg:gap-32 text-foreground text-center md:text-left"
>
<div className="order-first lg:h-full w-full max-w-md xl:max-w-2xl gap-8 flex flex-col items-center justify-center lg:items-start lg:justify-center text-center lg:text-left">
<div className="flex flex-col gap-1 max-w-md">
{/* Header */}
<div className="text-2xl">
{hasPlatinumTicket ? (
hasSecretTicket ? (
<p>Got the gold ticket, {FIRST_NAME}!</p>
) : (
<p className='font-["Departure_Mono"] uppercase'>
Good to see you, {FIRST_NAME}!
</p>
)
) : winningChances !== 2 ? (
<>
{hasSecretTicket && (
<p className='font-["Departure_Mono"] uppercase'>
{FIRST_NAME}, you're gold!
</p>
)}
{!hasSecretTicket && (
<p className='font-["Departure_Mono"] uppercase'>
Good to see you, {FIRST_NAME}!
</p>
)}
</>
) : (
<p className='font-["Departure_Mono"] uppercase'>
Good to see you, {FIRST_NAME}!
</p>
)}
</div>
</div>
<div className="flex flex-col gap-4 mt-2 md:mt-0 md:mb-12 items-center lg:items-start">
<TicketSwagCtaBox />
<TicketPresence className="opacity-0 invisible translate-y-1 transition-all" />
</div>
</div>
</m.div>
)}
</AnimatePresence>
</LazyMotion>
</div>
</SectionContainer>
<CanvasSingleMode />
{hasTicket && (
<ThreeTicketCanvas
username={DISPLAY_NAME ?? ''}
ticketType={ticketType}
className="relative -mt-44 -mb-10 lg:my-0 lg:absolute"
/>
)}
</>
)
}
export default TicketingFlow