diff --git a/app/components/homeComponents/home.tsx b/app/components/homeComponents/home.tsx index a176656..b8fe936 100644 --- a/app/components/homeComponents/home.tsx +++ b/app/components/homeComponents/home.tsx @@ -34,11 +34,7 @@ export default function HomePage() { useEffect(() => { setErrorMsg('') }, [value]) - useEffect(() => { - if (moment('2024-02-10T00:00:00.00+07:00').isAfter(data?.datetime) && !skip) { - disconnect() - } - }, [moment('2024-02-10T00:00:00.00+07:00').isAfter(data?.datetime), skip]) + const submitCodeHandler = async () => { try { if (loading) return diff --git a/app/components/homeComponents/lixiStage.tsx b/app/components/homeComponents/lixiStage.tsx index 87fd642..c11654b 100644 --- a/app/components/homeComponents/lixiStage.tsx +++ b/app/components/homeComponents/lixiStage.tsx @@ -17,8 +17,9 @@ import BlueGem from '@/assets/blue-gem.svg' import GoldGem from '@/assets/gold-gem.svg' import WhiteGem from '@/assets/white-gem.svg' import BgMobile from '@/assets/prize_mobile.png' -import Bg from '@/assets/prize.png' +import Bg from '@/assets/prize_p.png' import Logo from 'assets/logo.svg' +import confetti from 'canvas-confetti' export default function LixiStage() { const { isOpen, onOpen, onOpenChange, onClose } = useDisclosure() const { account } = useContext(Context) @@ -57,32 +58,6 @@ export default function LixiStage() { requestLoading={requestLoading} /> )} - - -
- -
-
-
Congratulations!
-
{account?.username}
-
-
50,000
-
AURA
-
-
- -
-
-
-
@@ -141,21 +116,94 @@ const Result = ({ requestId, setRequestLoading, isOpen, onOpenChange, requestLoa setRequestLoading(false) } }, [data?.request_manager?.[0]?.response?.code]) + + useEffect(() => { + const confettiPriority = + prize?.nftPrize?.token_type == 'RED' + ? 1 + : prize?.nftPrize?.token_type == 'GOLD' + ? 2 + : prize?.nftPrize?.token_type == 'BLUE' + ? 3 + : 0 + + if (confettiPriority == 3) { + confetti({ + particleCount: 100, + spread: 70, + origin: { y: 0.6 }, + }) + } + if (confettiPriority == 2) { + let defaults = { + spread: 360, + ticks: 50, + gravity: 0, + decay: 0.94, + startVelocity: 30, + colors: ['FFE400', 'FFBD00', 'E89400', 'FFCA6C', 'FDFFB8'], + } + + const shoot = () => { + confetti({ + ...defaults, + particleCount: 40, + scalar: 1.2, + shapes: ['star'], + }) + + confetti({ + ...defaults, + particleCount: 10, + scalar: 0.75, + shapes: ['circle'], + }) + } + + setTimeout(shoot, 0) + setTimeout(shoot, 100) + setTimeout(shoot, 200) + setTimeout(shoot, 300) + } + if (confettiPriority == 1) { + let end = Date.now() + 1000 + + // go Buckeyes! + let colors = ['#FFD569', '#FF697B'] + + ;(function frame() { + confetti({ + particleCount: 2, + angle: 60, + spread: 55, + origin: { x: 0 }, + colors: colors, + }) + confetti({ + particleCount: 2, + angle: 120, + spread: 55, + origin: { x: 1 }, + colors: colors, + }) + + if (Date.now() < end) { + requestAnimationFrame(frame) + } + })() + } + }, [prize?.auraPrize]) + + if (requestLoading) { + return ( + + <> + + ) + } if (prize?.auraPrize == 0) { return ( - +
Congratulations!
{account?.username}
@@ -184,15 +232,100 @@ const Result = ({ requestId, setRequestLoading, isOpen, onOpenChange, requestLoa
White Gem
)} - - {!!prize?.auraPrize && ( -
{`+ ${formatNumber( - fromMicro(prize?.auraPrize, 6) - )} AURA`}
- )}
) } else { + return ( + + +
+ + +
+
+
Congratulations!
+
{account?.username}
+
+
{`${formatNumber(fromMicro(prize?.auraPrize, 6))}`}
+
AURA
+
+
+
+ {prize?.nftPrize?.token_type == 'RED' ? ( + <> + +
Red Gem
+ + ) : prize?.nftPrize?.token_type == 'GOLD' ? ( + <> + +
Gold Gem
+ + ) : prize?.nftPrize?.token_type == 'BLUE' ? ( + <> + +
Blue Gem
+ + ) : ( + <> + +
White Gem
+ + )} +
+
+ +
+
+
+
+ Congratulations! {account?.username} +
+
+
+
{`${formatNumber(fromMicro(prize?.auraPrize, 6))}`}
+
AURA
+
+
+
+ {prize?.nftPrize?.token_type == 'RED' ? ( + <> + +
Red Gem
+ + ) : prize?.nftPrize?.token_type == 'GOLD' ? ( + <> + +
Gold Gem
+ + ) : prize?.nftPrize?.token_type == 'BLUE' ? ( + <> + +
Blue Gem
+ + ) : ( + <> + +
White Gem
+ + )} +
+
+
+ +
+
+
+
+ ) } } diff --git a/assets/prize_p.png b/assets/prize_p.png new file mode 100644 index 0000000..c97bde6 Binary files /dev/null and b/assets/prize_p.png differ