Compare commits
1 Commits
main
...
quick-bet-
Author | SHA1 | Date | |
---|---|---|---|
|
905e5c0de8 |
|
@ -96,7 +96,7 @@ export function ContractCard(props: {
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
{showQuickBet ? (
|
{showQuickBet ? (
|
||||||
<QuickBet contract={contract} />
|
<QuickBet contract={contract} className="-my-4" showBar />
|
||||||
) : (
|
) : (
|
||||||
<Col className="m-auto pl-2">
|
<Col className="m-auto pl-2">
|
||||||
{outcomeType === 'BINARY' && (
|
{outcomeType === 'BINARY' && (
|
||||||
|
|
|
@ -33,8 +33,12 @@ import { useSaveShares } from '../use-save-shares'
|
||||||
|
|
||||||
const BET_SIZE = 10
|
const BET_SIZE = 10
|
||||||
|
|
||||||
export function QuickBet(props: { contract: Contract }) {
|
export function QuickBet(props: {
|
||||||
const { contract } = props
|
contract: Contract
|
||||||
|
className?: string
|
||||||
|
showBar?: boolean
|
||||||
|
}) {
|
||||||
|
const { contract, className, showBar } = props
|
||||||
|
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
const userBets = useUserContractBets(user?.id, contract.id)
|
const userBets = useUserContractBets(user?.id, contract.id)
|
||||||
|
@ -116,9 +120,10 @@ export function QuickBet(props: { contract: Contract }) {
|
||||||
return (
|
return (
|
||||||
<Col
|
<Col
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'relative -my-4 -mr-5 min-w-[5.5rem] justify-center gap-2 pr-5 pl-1 align-middle'
|
'relative -mr-5 min-w-[5.5rem] justify-center gap-2 pr-5 pl-1 align-middle',
|
||||||
// Use this for colored QuickBet panes
|
// Use this for colored QuickBet panes
|
||||||
// `bg-opacity-10 bg-${color}`
|
// `bg-opacity-10 bg-${color}`
|
||||||
|
className
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{/* Up bet triangle */}
|
{/* Up bet triangle */}
|
||||||
|
@ -150,7 +155,11 @@ export function QuickBet(props: { contract: Contract }) {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<QuickOutcomeView contract={contract} previewProb={previewProb} />
|
<QuickOutcomeView
|
||||||
|
contract={contract}
|
||||||
|
previewProb={previewProb}
|
||||||
|
showBar={showBar}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Down bet triangle */}
|
{/* Down bet triangle */}
|
||||||
<div>
|
<div>
|
||||||
|
@ -213,8 +222,9 @@ function QuickOutcomeView(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
previewProb?: number
|
previewProb?: number
|
||||||
caption?: 'chance' | 'expected'
|
caption?: 'chance' | 'expected'
|
||||||
|
showBar?: boolean
|
||||||
}) {
|
}) {
|
||||||
const { contract, previewProb, caption } = props
|
const { contract, previewProb, caption, showBar } = props
|
||||||
const { outcomeType } = contract
|
const { outcomeType } = contract
|
||||||
// If there's a preview prob, display that instead of the current prob
|
// If there's a preview prob, display that instead of the current prob
|
||||||
const override =
|
const override =
|
||||||
|
@ -242,7 +252,7 @@ function QuickOutcomeView(props: {
|
||||||
<Col className={clsx('items-center text-3xl', textColor)}>
|
<Col className={clsx('items-center text-3xl', textColor)}>
|
||||||
{override ?? display}
|
{override ?? display}
|
||||||
{caption && <div className="text-base">{caption}</div>}
|
{caption && <div className="text-base">{caption}</div>}
|
||||||
<ProbBar contract={contract} previewProb={previewProb} />
|
{showBar && <ProbBar contract={contract} previewProb={previewProb} />}
|
||||||
</Col>
|
</Col>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,16 +8,13 @@ import {
|
||||||
NumericContract,
|
NumericContract,
|
||||||
} from 'common/contract'
|
} from 'common/contract'
|
||||||
import { DOMAIN } from 'common/envs/constants'
|
import { DOMAIN } from 'common/envs/constants'
|
||||||
|
import { useEffect } from 'react'
|
||||||
import { AnswersGraph } from 'web/components/answers/answers-graph'
|
import { AnswersGraph } from 'web/components/answers/answers-graph'
|
||||||
import BetRow from 'web/components/bet-row'
|
import BetRow from 'web/components/bet-row'
|
||||||
import {
|
|
||||||
BinaryResolutionOrChance,
|
|
||||||
FreeResponseResolutionOrChance,
|
|
||||||
NumericResolutionOrExpectation,
|
|
||||||
} from 'web/components/contract/contract-card'
|
|
||||||
import { ContractDetails } from 'web/components/contract/contract-details'
|
import { ContractDetails } from 'web/components/contract/contract-details'
|
||||||
import { ContractProbGraph } from 'web/components/contract/contract-prob-graph'
|
import { ContractProbGraph } from 'web/components/contract/contract-prob-graph'
|
||||||
import { NumericGraph } from 'web/components/contract/numeric-graph'
|
import { NumericGraph } from 'web/components/contract/numeric-graph'
|
||||||
|
import { QuickBet } from 'web/components/contract/quick-bet'
|
||||||
import { Col } from 'web/components/layout/col'
|
import { Col } from 'web/components/layout/col'
|
||||||
import { Row } from 'web/components/layout/row'
|
import { Row } from 'web/components/layout/row'
|
||||||
import { Spacer } from 'web/components/layout/spacer'
|
import { Spacer } from 'web/components/layout/spacer'
|
||||||
|
@ -114,31 +111,16 @@ function ContractEmbed(props: { contract: Contract; bets: Bet[] }) {
|
||||||
isCreator={false}
|
isCreator={false}
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
|
<Row className="items-center gap-4">
|
||||||
{isBinary && (
|
{isBinary && (
|
||||||
<Row className="items-center gap-4">
|
|
||||||
<BetRow
|
<BetRow
|
||||||
contract={contract as BinaryContract}
|
contract={contract as BinaryContract}
|
||||||
betPanelClassName="scale-75"
|
betPanelClassName="scale-75"
|
||||||
/>
|
/>
|
||||||
<BinaryResolutionOrChance contract={contract} />
|
)}
|
||||||
</Row>
|
<QuickBet contract={contract} />
|
||||||
)}
|
</Row>
|
||||||
|
|
||||||
{outcomeType === 'FREE_RESPONSE' && (
|
|
||||||
<FreeResponseResolutionOrChance
|
|
||||||
contract={contract}
|
|
||||||
truncate="long"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{outcomeType === 'NUMERIC' && (
|
|
||||||
<NumericResolutionOrExpectation
|
|
||||||
contract={contract as NumericContract}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Spacer h={2} />
|
<Spacer h={2} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user