File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 22
33import Image from "next/image" ;
44import { useEffect , useState } from "react" ;
5+ import Confetti from "react-confetti" ;
6+ import { useWindowSize } from "react-use" ;
57
68interface PrizeDrawAnimationProps {
79 participants : User [ ] ;
@@ -30,6 +32,7 @@ export function PrizeDrawAnimation({
3032 const [ showWinner , setShowWinner ] = useState ( false ) ;
3133 const [ showPrize , setShowPrize ] = useState ( false ) ;
3234 const [ animationDuration , setAnimationDuration ] = useState ( 1000 ) ;
35+ const { width : windowWidth , height : windowHeight } = useWindowSize ( ) ;
3336
3437 useEffect ( ( ) => {
3538 // Calculate dynamic timing based on participant count
@@ -191,6 +194,14 @@ export function PrizeDrawAnimation({
191194 { /* Winner reveal */ }
192195 { showWinner && (
193196 < div className = "absolute inset-0 flex items-center justify-center animate-winner-reveal" >
197+ { /* Confetti effect */ }
198+ < Confetti
199+ width = { windowWidth }
200+ height = { windowHeight }
201+ numberOfPieces = { 500 }
202+ recycle = { false }
203+ />
204+
194205 < div className = "relative flex flex-col items-center gap-6" >
195206 < div className = "relative" >
196207 < Image
Original file line number Diff line number Diff line change @@ -106,12 +106,14 @@ export function PrizeTile({
106106 />
107107 { winner && ! isOverlayOpen && (
108108 < div className = "flex flex-col justify-center items-center text-center gap-y-2 w-full" >
109- < Confetti
110- width = { windowWidth }
111- height = { windowHeight }
112- numberOfPieces = { 500 }
113- recycle = { false }
114- />
109+ { disableAnimation && (
110+ < Confetti
111+ width = { windowWidth }
112+ height = { windowHeight }
113+ numberOfPieces = { 500 }
114+ recycle = { false }
115+ />
116+ ) }
115117 < Link href = { `/users/${ winner . id } ` } >
116118 < Image
117119 className = "size-[128px] object-contain"
You can’t perform that action at this time.
0 commit comments