import React from 'react' import clsx from 'clsx' import { tradingAllowed } from 'web/lib/firebase/contracts' import { Col } from '../layout/col' import { Spacer } from '../layout/spacer' import { ContractProbGraph } from './contract-prob-graph' import { useUser } from 'web/hooks/use-user' import { Row } from '../layout/row' import { Linkify } from '../linkify' import { BinaryResolutionOrChance, FreeResponseResolutionOrChance, NumericResolutionOrExpectation, PseudoNumericResolutionOrExpectation, } from './contract-card' import { Bet } from 'common/bet' import BetButton from '../bet-button' import { AnswersGraph } from '../answers/answers-graph' import { Contract, CPMMBinaryContract } from 'common/contract' import { ContractDescription } from './contract-description' import { ContractDetails } from './contract-details' import { NumericGraph } from './numeric-graph' import { ShareRow } from './share-row' import { FollowMarketButton } from 'web/components/follow-market-button' export const ContractOverview = (props: { contract: Contract bets: Bet[] className?: string }) => { const { contract, bets, className } = props const { question, creatorId, outcomeType, resolution } = contract const user = useUser() const isCreator = user?.id === creatorId const isBinary = outcomeType === 'BINARY' const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC' return (
{(outcomeType === 'FREE_RESPONSE' || outcomeType === 'MULTIPLE_CHOICE') && !resolution && (
)}
{isBinary && ( )} {isPseudoNumeric && ( )} {outcomeType === 'NUMERIC' && ( )}
{isBinary ? ( {tradingAllowed(contract) && ( )} ) : isPseudoNumeric ? ( {tradingAllowed(contract) && } ) : ( (outcomeType === 'FREE_RESPONSE' || outcomeType === 'MULTIPLE_CHOICE') && resolution && ( ) )} {outcomeType === 'NUMERIC' && ( )} {(isBinary || isPseudoNumeric) && ( )}{' '} {(outcomeType === 'FREE_RESPONSE' || outcomeType === 'MULTIPLE_CHOICE') && ( )} {outcomeType === 'NUMERIC' && } ) }