diff --git a/web/components/answers/answer-item.tsx b/web/components/answers/answer-item.tsx index f1ab2f88..3b25b8b4 100644 --- a/web/components/answers/answer-item.tsx +++ b/web/components/answers/answer-item.tsx @@ -92,7 +92,7 @@ export function AnswerItem(props: {
{probPercent} diff --git a/web/components/contract/quick-bet.tsx b/web/components/contract/quick-bet.tsx index a71b6c7d..dbbe34d2 100644 --- a/web/components/contract/quick-bet.tsx +++ b/web/components/contract/quick-bet.tsx @@ -42,8 +42,9 @@ export function QuickBet(props: { contract: BinaryContract | PseudoNumericContract user: User className?: string + noProbBar?: boolean }) { - const { contract, user, className } = props + const { contract, user, className, noProbBar } = props const { mechanism, outcomeType } = contract const isCpmm = mechanism === 'cpmm-1' @@ -162,20 +163,24 @@ export function QuickBet(props: { ) : ( )}
- + {/* Down bet triangle */} {outcomeType !== 'BINARY' && outcomeType !== 'PSEUDO_NUMERIC' ? ( @@ -266,8 +271,9 @@ function QuickOutcomeView(props: { contract: Contract previewProb?: number caption?: 'chance' | 'expected' + noProbBar?: boolean }) { - const { contract, previewProb, caption } = props + const { contract, previewProb, caption, noProbBar } = props const { outcomeType } = contract const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC' @@ -305,7 +311,7 @@ function QuickOutcomeView(props: { {override ?? display} {caption &&
{caption}
} - + {!noProbBar && } ) } diff --git a/web/pages/embed/[username]/[contractSlug].tsx b/web/pages/embed/[username]/[contractSlug].tsx index 74076869..2415bcf7 100644 --- a/web/pages/embed/[username]/[contractSlug].tsx +++ b/web/pages/embed/[username]/[contractSlug].tsx @@ -27,6 +27,9 @@ import { tradingAllowed, } from 'web/lib/firebase/contracts' import Custom404 from '../../404' +import { useUser } from 'web/hooks/use-user' +import { QuickBet } from 'web/components/contract/quick-bet' +import { contractMetrics } from 'common/contract-details' export const getStaticProps = fromPropz(getStaticPropz) export async function getStaticPropz(props: { @@ -74,66 +77,86 @@ export function ContractEmbed(props: { contract: Contract; bets: Bet[] }) { creatorId: contract.creatorId, }) + const { creatorName, creatorUsername, creatorId, creatorAvatarUrl } = contract + const { resolvedDate } = contractMetrics(contract) const isBinary = outcomeType === 'BINARY' const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC' const href = `https://${DOMAIN}${contractPath(contract)}` - const { setElem, height: graphHeight } = useMeasureSize() + const { setElem, width: graphWidth, height: graphHeight } = useMeasureSize() const [betPanelOpen, setBetPanelOpen] = useState(false) const [probAfter, setProbAfter] = useState() - return ( - - -
- {question} -
- {isBinary && ( - - )} - - {isPseudoNumeric && ( - - )} - - {outcomeType === 'FREE_RESPONSE' && ( - - )} - - {outcomeType === 'NUMERIC' && ( - - )} -
- - - - - {(isBinary || isPseudoNumeric) && - tradingAllowed(contract) && - !betPanelOpen && ( - - )} - - - - - {(isBinary || isPseudoNumeric) && betPanelOpen && ( - setBetPanelOpen(false)} - className="self-center" + const user = useUser() + if (user && (isBinary || isPseudoNumeric)) { + return ( + + + +
+ {question} +
+ +
@{creatorUsername}
+
{creatorUsername}
+
+ +
+ +
+ + - )} +
+ ) + } else + return ( + + + +
+ {question} +
+ {/* */} + +
@{creatorUsername}
+
@{creatorUsername}
+
+ + + {!user && isBinary && ( + + )} -
- -
- - ) + {!user && isPseudoNumeric && ( + + )} + + {outcomeType === 'FREE_RESPONSE' && ( + + )} + {outcomeType === 'NUMERIC' && ( + + )} + + +
+
+ +
+ + ) }