11import { useSearch } from '@tanstack/react-router'
2+ import ConfettiExplosion from 'react-confetti-explosion'
23import { useAtom } from 'jotai'
34import { useCallback , useState } from 'react'
45import { Toaster } from 'react-hot-toast'
@@ -19,6 +20,7 @@ function PremiumPage() {
1920 const premiumState = usePremium ( )
2021 const [ deactivating , setDeactivating ] = useState ( false )
2122 const { source } = useSearch ( { from : premiumRoute . id } )
23+ const [ isExploding , setIsExploding ] = useState ( false )
2224
2325 const activateLicense = useCallback ( ( ) => {
2426 const key = window . prompt ( 'Enter your license key' , '' )
@@ -55,7 +57,12 @@ function PremiumPage() {
5557 < div className = "flex flex-row items-center gap-3 mt-10" >
5658 { premiumState . activated ? (
5759 < >
58- < Button text = { t ( '🎉 License activated' ) } color = "primary" className = "w-fit !py-2" />
60+ < Button
61+ text = { t ( '🎉 License activated' ) }
62+ color = "primary"
63+ className = "w-fit !py-2"
64+ onClick = { ( ) => setIsExploding ( true ) }
65+ />
5966 < Button
6067 text = { t ( 'Deactivate' ) }
6168 className = "w-fit !py-2"
@@ -93,6 +100,7 @@ function PremiumPage() {
93100 </ div >
94101 { ! ! premiumState . error && < span className = "mt-3 text-red-500 font-medium" > { premiumState . error } </ span > }
95102 < Toaster position = "top-right" />
103+ { isExploding && < ConfettiExplosion duration = { 3000 } onComplete = { ( ) => setIsExploding ( false ) } /> }
96104 </ div >
97105 )
98106}
0 commit comments