diff --git a/web/components/fullscreen-confetti.tsx b/web/components/fullscreen-confetti.tsx new file mode 100644 index 00000000..390b3a9b --- /dev/null +++ b/web/components/fullscreen-confetti.tsx @@ -0,0 +1,7 @@ +import Confetti, { Props as ConfettiProps } from 'react-confetti' +import { useWindowSize } from 'web/hooks/use-window-size' + +export function FullscreenConfetti(props: ConfettiProps) { + const { width, height } = useWindowSize() + return +} diff --git a/web/components/user-page.tsx b/web/components/user-page.tsx index 1adf9f2d..322ddb96 100644 --- a/web/components/user-page.tsx +++ b/web/components/user-page.tsx @@ -4,7 +4,6 @@ import { useEffect, useState } from 'react' import { useRouter } from 'next/router' import { LinkIcon } from '@heroicons/react/solid' import { PencilIcon } from '@heroicons/react/outline' -import Confetti from 'react-confetti' import { getPortfolioHistory, User } from 'web/lib/firebase/users' import { CreatorContractsList } from './contract/contracts-grid' @@ -19,11 +18,11 @@ import { Row } from './layout/row' import { genHash } from 'common/util/random' import { QueryUncontrolledTabs } from './layout/tabs' import { UserCommentsList } from './comments-list' -import { useWindowSize } from 'web/hooks/use-window-size' import { Comment, getUsersComments } from 'web/lib/firebase/comments' import { Contract } from 'common/contract' import { getContractFromId, listContracts } from 'web/lib/firebase/contracts' import { LoadingIndicator } from './loading-indicator' +import { FullscreenConfetti } from 'web/components/fullscreen-confetti' import { BetsList } from './bets-list' import { FollowersButton, FollowingButton } from './following-button' import { UserFollowButton } from './follow-button' @@ -82,7 +81,6 @@ export function UserPage(props: { user: User; currentUser?: User }) { Dictionary | undefined >() const [showConfetti, setShowConfetti] = useState(false) - const { width, height } = useWindowSize() useEffect(() => { const claimedMana = router.query['claimed-mana'] === 'yes' @@ -124,12 +122,7 @@ export function UserPage(props: { user: User; currentUser?: User }) { url={`/${user.username}`} /> {showConfetti && ( - + )} {/* Banner image up top, with an circle avatar overlaid */} { @@ -194,12 +191,7 @@ export function ContractPageContent( return ( {showConfetti && ( - + )} {ogCardProps && (