From 6c2877153946425649e9d29b305d51102f22c26d Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 6 May 2022 14:57:21 -0400 Subject: [PATCH] Remove focus --- common/calculate-dpm.ts | 19 ++++++++++++++++++- web/components/numeric-bet-panel.tsx | 9 --------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/common/calculate-dpm.ts b/common/calculate-dpm.ts index da929909..39f97585 100644 --- a/common/calculate-dpm.ts +++ b/common/calculate-dpm.ts @@ -1,6 +1,12 @@ import * as _ from 'lodash' import { Bet } from './bet' -import { Binary, DPM, FreeResponse, FullContract } from './contract' +import { + Binary, + DPM, + FreeResponse, + FullContract, + NumericContract, +} from './contract' import { DPM_FEES } from './fees' export function getDpmProbability(totalShares: { [outcome: string]: number }) { @@ -26,6 +32,17 @@ export function getDpmOutcomeProbabilities(totalShares: { return _.mapValues(totalShares, (shares) => shares ** 2 / squareSum) } +export function getNumericBets( + contract: NumericContract, + bucket: string, + betAmount: number +) { + const { totalShares, bucketCount } = contract + + const bucketNum = +bucket + // const bucketRange = +} + export function getDpmOutcomeProbabilityAfterBet( totalShares: { [outcome: string]: number diff --git a/web/components/numeric-bet-panel.tsx b/web/components/numeric-bet-panel.tsx index 0911b6c8..d45207fa 100644 --- a/web/components/numeric-bet-panel.tsx +++ b/web/components/numeric-bet-panel.tsx @@ -9,7 +9,6 @@ import { } from '../../common/calculate' import { NumericContract } from '../../common/contract' import { formatPercent, formatMoney } from '../../common/util/format' -import { useFocus } from '../hooks/use-focus' import { useUser } from '../hooks/use-user' import { placeBet } from '../lib/firebase/api-call' import { firebaseLogin, User } from '../lib/firebase/users' @@ -59,12 +58,6 @@ function NumericBuyPanel(props: { const [isSubmitting, setIsSubmitting] = useState(false) const [wasSubmitted, setWasSubmitted] = useState(false) - const [inputRef, focusAmountInput] = useFocus() - - useEffect(() => { - focusAmountInput() - }, [focusAmountInput]) - function onBucketChange(newBucket: string | undefined) { setWasSubmitted(false) setBucketChoice(newBucket) @@ -139,7 +132,6 @@ function NumericBuyPanel(props: { error={error} setError={setError} disabled={isSubmitting} - inputRef={inputRef} />
Amount
@@ -150,7 +142,6 @@ function NumericBuyPanel(props: { error={error} setError={setError} disabled={isSubmitting} - inputRef={inputRef} />