bug fixes
This commit is contained in:
parent
aed48dfb22
commit
ff6ce54b4b
|
@ -2,7 +2,11 @@ import { useState } from 'react'
|
|||
import clsx from 'clsx'
|
||||
|
||||
import { BuyPanel, SimpleBetPanel } from './bet-panel'
|
||||
import { CPMMBinaryContract, PseudoNumericContract } from 'common/contract'
|
||||
import {
|
||||
BinaryContract,
|
||||
CPMMBinaryContract,
|
||||
PseudoNumericContract,
|
||||
} from 'common/contract'
|
||||
import { Modal } from './layout/modal'
|
||||
import { useUser } from 'web/hooks/use-user'
|
||||
import { useUserContractBets } from 'web/hooks/use-user-bets'
|
||||
|
@ -78,9 +82,7 @@ export default function BetButton(props: {
|
|||
)
|
||||
}
|
||||
|
||||
export function BinaryMobileBetting(props: {
|
||||
contract: CPMMBinaryContract | Contract
|
||||
}) {
|
||||
export function BinaryMobileBetting(props: { contract: CPMMBinaryContract }) {
|
||||
const { contract } = props
|
||||
const user = useUser()
|
||||
if (user) {
|
||||
|
@ -99,13 +101,10 @@ export function BinaryMobileBetting(props: {
|
|||
}
|
||||
|
||||
export function SignedInBinaryMobileBetting(props: {
|
||||
contract: CPMMBinaryContract | Contract
|
||||
contract: CPMMBinaryContract | PseudoNumericContract
|
||||
user: User
|
||||
}) {
|
||||
const { contract, user } = props
|
||||
const [betChoice, _setBetChoice] = useState<'YES' | 'NO' | undefined>(
|
||||
undefined
|
||||
)
|
||||
const unfilledBets = useUnfilledBets(contract.id) ?? []
|
||||
|
||||
return (
|
||||
|
@ -117,7 +116,6 @@ export function SignedInBinaryMobileBetting(props: {
|
|||
contract={contract}
|
||||
user={user}
|
||||
unfilledBets={unfilledBets}
|
||||
selected={betChoice}
|
||||
mobileView={true}
|
||||
/>
|
||||
</Col>
|
||||
|
|
|
@ -3,7 +3,11 @@ import React, { useState } from 'react'
|
|||
import { clamp, partition, sumBy } from 'lodash'
|
||||
|
||||
import { useUser } from 'web/hooks/use-user'
|
||||
import { CPMMBinaryContract, PseudoNumericContract } from 'common/contract'
|
||||
import {
|
||||
Contract,
|
||||
CPMMBinaryContract,
|
||||
PseudoNumericContract,
|
||||
} from 'common/contract'
|
||||
import { Col } from './layout/col'
|
||||
import { Row } from './layout/row'
|
||||
import { Spacer } from './layout/spacer'
|
||||
|
@ -146,7 +150,6 @@ export function SimpleBetPanel(props: {
|
|||
contract={contract}
|
||||
user={user}
|
||||
unfilledBets={unfilledBets}
|
||||
selected={selected}
|
||||
onBuySuccess={onBetSuccess}
|
||||
/>
|
||||
<LimitOrderPanel
|
||||
|
@ -481,7 +484,6 @@ function LimitOrderPanel(props: {
|
|||
const betChoice = 'YES'
|
||||
const [error, setError] = useState<string | undefined>()
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
const [wasSubmitted, setWasSubmitted] = useState(false)
|
||||
|
||||
const rangeError =
|
||||
lowLimitProb !== undefined &&
|
||||
|
@ -529,7 +531,6 @@ function LimitOrderPanel(props: {
|
|||
const noAmount = shares * (1 - (noLimitProb ?? 0))
|
||||
|
||||
function onBetChange(newAmount: number | undefined) {
|
||||
setWasSubmitted(false)
|
||||
setBetAmount(newAmount)
|
||||
}
|
||||
|
||||
|
@ -574,7 +575,6 @@ function LimitOrderPanel(props: {
|
|||
.then((r) => {
|
||||
console.log('placed bet. Result:', r)
|
||||
setIsSubmitting(false)
|
||||
setWasSubmitted(true)
|
||||
setBetAmount(undefined)
|
||||
setLowLimitProb(undefined)
|
||||
setHighLimitProb(undefined)
|
||||
|
@ -810,8 +810,6 @@ function LimitOrderPanel(props: {
|
|||
: `Submit order${hasTwoBets ? 's' : ''}`}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{wasSubmitted && <div className="mt-4">Order submitted!</div>}
|
||||
</Col>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import {
|
|||
MultipleChoiceContract,
|
||||
NumericContract,
|
||||
PseudoNumericContract,
|
||||
CPMMBinaryContract,
|
||||
} from 'common/contract'
|
||||
import { ContractDetails } from './contract-details'
|
||||
import { NumericGraph } from './numeric-graph'
|
||||
|
@ -68,7 +69,10 @@ const NumericOverview = (props: { contract: NumericContract }) => {
|
|||
)
|
||||
}
|
||||
|
||||
const BinaryOverview = (props: { contract: BinaryContract; bets: Bet[] }) => {
|
||||
const BinaryOverview = (props: {
|
||||
contract: CPMMBinaryContract
|
||||
bets: Bet[]
|
||||
}) => {
|
||||
const { contract, bets } = props
|
||||
return (
|
||||
<Col className="gap-1 md:gap-2">
|
||||
|
@ -86,7 +90,7 @@ const BinaryOverview = (props: { contract: BinaryContract; bets: Bet[] }) => {
|
|||
<ContractProbGraph contract={contract} bets={[...bets].reverse()} />
|
||||
<Row className="items-center justify-between gap-4 xl:hidden">
|
||||
{tradingAllowed(contract) && (
|
||||
<BinaryMobileBetting className={'my-2'} contract={contract} />
|
||||
<BinaryMobileBetting contract={contract} />
|
||||
)}
|
||||
</Row>
|
||||
</Col>
|
||||
|
|
Loading…
Reference in New Issue
Block a user