From 3d772a8a9b28411d78e9fa2e7a5817fc02fe0cdf Mon Sep 17 00:00:00 2001 From: ingawei Date: Sat, 17 Sep 2022 00:10:40 -0700 Subject: [PATCH] Getting basic functionality working --- web/components/bet-button.tsx | 106 +++++++++----- web/components/bet-panel.tsx | 219 ++++++++++++++++++----------- web/components/yes-no-selector.tsx | 14 +- 3 files changed, 213 insertions(+), 126 deletions(-) diff --git a/web/components/bet-button.tsx b/web/components/bet-button.tsx index 34322423..7bf44a6a 100644 --- a/web/components/bet-button.tsx +++ b/web/components/bet-button.tsx @@ -1,8 +1,9 @@ import { useState } from 'react' import clsx from 'clsx' -import { SimpleBetPanel } from './bet-panel' +import { BetPanel, BuyPanel, SimpleBetPanel } from './bet-panel' import { CPMMBinaryContract, PseudoNumericContract } from 'common/contract' +import { getBinaryBetStats, getBinaryCpmmBetInfo } from 'common/new-bet' import { Modal } from './layout/modal' import { useUser } from 'web/hooks/use-user' import { useUserContractBets } from 'web/hooks/use-user-bets' @@ -17,6 +18,13 @@ import { User } from 'web/lib/firebase/users' import { SellRow } from './sell-row' import { PlayMoneyDisclaimer } from './play-money-disclaimer' import { Row } from './layout/row' +import { useUnfilledBets } from 'web/hooks/use-bets' +import { Bet } from 'common/bet' +import { getProbability } from 'common/calculate' +import { useFocus } from 'web/hooks/use-focus' +import { isAndroid, isIOS } from 'web/lib/util/device' +import { APIError, placeBet } from 'web/lib/firebase/api' +import { track } from '@amplitude/analytics-browser' /** Button that opens BetPanel in a new modal */ export default function BetButton(props: { @@ -105,44 +113,72 @@ export function SignedInBinaryMobileBetting(props: { contract: CPMMBinaryContract user: User }) { - enum betChoiceState { - YES = 'yes', - NO = 'no', - NEITHER = 'neither', - } const { contract, user } = props - const [betChoice, setBetChoice] = useState( - betChoiceState.NEITHER + const [betChoice, setBetChoice] = useState<'YES' | 'NO' | undefined>( + undefined ) + const unfilledBets = useUnfilledBets(contract.id) ?? [] + return ( <> - {/* GET BACK TO THIS BUT GAH DAMN IT'S UGLY */} - {/* */} - - - + + {/* */} + {/* + + + */} + +