diff --git a/web/components/amount-input.tsx b/web/components/amount-input.tsx index 1c9d1c3b..dc5a6124 100644 --- a/web/components/amount-input.tsx +++ b/web/components/amount-input.tsx @@ -5,7 +5,7 @@ import { formatMoney } from 'common/util/format' import { Col } from './layout/col' import { SiteLink } from './site-link' import { ENV_CONFIG } from 'common/envs/constants' -import { useWindowSize } from 'web/hooks/use-window-size' +import { useIsMobile } from 'web/hooks/use-is-mobile' import { Row } from './layout/row' export function AmountInput(props: { @@ -36,8 +36,7 @@ export function AmountInput(props: { onChange(isInvalid ? undefined : amount) } - const { width } = useWindowSize() - const isMobile = (width ?? 0) < 768 + const isMobile = useIsMobile(768) return ( <> diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index e93c0e62..beb7168a 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -47,7 +47,6 @@ import { Modal } from './layout/modal' import { Title } from './title' import toast from 'react-hot-toast' import { CheckIcon } from '@heroicons/react/solid' -import { useWindowSize } from 'web/hooks/use-window-size' export function BetPanel(props: { contract: CPMMBinaryContract | PseudoNumericContract @@ -179,12 +178,7 @@ export function BuyPanel(props: { const initialProb = getProbability(contract) const isPseudoNumeric = contract.outcomeType === 'PSEUDO_NUMERIC' - const windowSize = useWindowSize() - const initialOutcome = - windowSize.width && windowSize.width >= 1280 ? 'YES' : undefined - const [outcome, setOutcome] = useState<'YES' | 'NO' | undefined>( - initialOutcome - ) + const [outcome, setOutcome] = useState<'YES' | 'NO' | undefined>() const [betAmount, setBetAmount] = useState(10) const [error, setError] = useState() const [isSubmitting, setIsSubmitting] = useState(false)