Remove focus
This commit is contained in:
parent
899244bd3f
commit
6c28771539
|
@ -1,6 +1,12 @@
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
import { Bet } from './bet'
|
import { Bet } from './bet'
|
||||||
import { Binary, DPM, FreeResponse, FullContract } from './contract'
|
import {
|
||||||
|
Binary,
|
||||||
|
DPM,
|
||||||
|
FreeResponse,
|
||||||
|
FullContract,
|
||||||
|
NumericContract,
|
||||||
|
} from './contract'
|
||||||
import { DPM_FEES } from './fees'
|
import { DPM_FEES } from './fees'
|
||||||
|
|
||||||
export function getDpmProbability(totalShares: { [outcome: string]: number }) {
|
export function getDpmProbability(totalShares: { [outcome: string]: number }) {
|
||||||
|
@ -26,6 +32,17 @@ export function getDpmOutcomeProbabilities(totalShares: {
|
||||||
return _.mapValues(totalShares, (shares) => shares ** 2 / squareSum)
|
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(
|
export function getDpmOutcomeProbabilityAfterBet(
|
||||||
totalShares: {
|
totalShares: {
|
||||||
[outcome: string]: number
|
[outcome: string]: number
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
} from '../../common/calculate'
|
} from '../../common/calculate'
|
||||||
import { NumericContract } from '../../common/contract'
|
import { NumericContract } from '../../common/contract'
|
||||||
import { formatPercent, formatMoney } from '../../common/util/format'
|
import { formatPercent, formatMoney } from '../../common/util/format'
|
||||||
import { useFocus } from '../hooks/use-focus'
|
|
||||||
import { useUser } from '../hooks/use-user'
|
import { useUser } from '../hooks/use-user'
|
||||||
import { placeBet } from '../lib/firebase/api-call'
|
import { placeBet } from '../lib/firebase/api-call'
|
||||||
import { firebaseLogin, User } from '../lib/firebase/users'
|
import { firebaseLogin, User } from '../lib/firebase/users'
|
||||||
|
@ -59,12 +58,6 @@ function NumericBuyPanel(props: {
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||||
const [wasSubmitted, setWasSubmitted] = useState(false)
|
const [wasSubmitted, setWasSubmitted] = useState(false)
|
||||||
|
|
||||||
const [inputRef, focusAmountInput] = useFocus()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
focusAmountInput()
|
|
||||||
}, [focusAmountInput])
|
|
||||||
|
|
||||||
function onBucketChange(newBucket: string | undefined) {
|
function onBucketChange(newBucket: string | undefined) {
|
||||||
setWasSubmitted(false)
|
setWasSubmitted(false)
|
||||||
setBucketChoice(newBucket)
|
setBucketChoice(newBucket)
|
||||||
|
@ -139,7 +132,6 @@ function NumericBuyPanel(props: {
|
||||||
error={error}
|
error={error}
|
||||||
setError={setError}
|
setError={setError}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
inputRef={inputRef}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="my-3 text-left text-sm text-gray-500">Amount</div>
|
<div className="my-3 text-left text-sm text-gray-500">Amount</div>
|
||||||
|
@ -150,7 +142,6 @@ function NumericBuyPanel(props: {
|
||||||
error={error}
|
error={error}
|
||||||
setError={setError}
|
setError={setError}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
inputRef={inputRef}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Col className="mt-3 w-full gap-3">
|
<Col className="mt-3 w-full gap-3">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user