From 93033b5b243ca115806f3ec755a167e9d29cab79 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Sat, 10 Sep 2022 21:57:50 -0500 Subject: [PATCH] Revert "Yes and no buttons on contract page (#868)" This reverts commit b39e0f304f7472e0e3e2ae2539b9c0f56d26b430. --- web/components/bet-button.tsx | 23 ++-- web/components/contract/contract-card.tsx | 8 +- web/components/contract/contract-overview.tsx | 41 ++---- web/components/contract/quick-bet-button.tsx | 128 ------------------ .../{quick-bet-arrows.tsx => quick-bet.tsx} | 4 +- 5 files changed, 25 insertions(+), 179 deletions(-) delete mode 100644 web/components/contract/quick-bet-button.tsx rename web/components/contract/{quick-bet-arrows.tsx => quick-bet.tsx} (98%) diff --git a/web/components/bet-button.tsx b/web/components/bet-button.tsx index 2aadbc78..0bd3702f 100644 --- a/web/components/bet-button.tsx +++ b/web/components/bet-button.tsx @@ -32,17 +32,6 @@ export default function BetButton(props: { return ( <> - {user && ( -
- {hasYesShares - ? `(${Math.floor(yesShares)} ${ - isPseudoNumeric ? 'HIGHER' : 'YES' - })` - : hasNoShares - ? `(${Math.floor(noShares)} ${isPseudoNumeric ? 'LOWER' : 'NO'})` - : ''} -
- )} {user ? ( - ) -} - -// Return a number from 0 to 1 for this contract -// Resolved contracts are set to 1, for coloring purposes (even if NO) -function getProb(contract: Contract) { - const { outcomeType, resolution, resolutionProbability } = contract - return resolutionProbability - ? resolutionProbability - : resolution - ? 1 - : outcomeType === 'BINARY' - ? getBinaryProb(contract) - : outcomeType === 'PSEUDO_NUMERIC' - ? getProbability(contract) - : outcomeType === 'FREE_RESPONSE' || outcomeType === 'MULTIPLE_CHOICE' - ? getOutcomeProbability(contract, getTopAnswer(contract)?.id || '') - : outcomeType === 'NUMERIC' - ? getNumericScale(contract) - : 1 // Should not happen -} - -function getNumericScale(contract: NumericContract) { - const { min, max } = contract - const ev = getExpectedValue(contract) - return (ev - min) / (max - min) -} diff --git a/web/components/contract/quick-bet-arrows.tsx b/web/components/contract/quick-bet.tsx similarity index 98% rename from web/components/contract/quick-bet-arrows.tsx rename to web/components/contract/quick-bet.tsx index 678963bf..7b19306f 100644 --- a/web/components/contract/quick-bet-arrows.tsx +++ b/web/components/contract/quick-bet.tsx @@ -38,7 +38,7 @@ import { getBinaryProb } from 'common/contract-details' const BET_SIZE = 10 -export function QuickBetArrows(props: { +export function QuickBet(props: { contract: BinaryContract | PseudoNumericContract user: User className?: string @@ -243,7 +243,7 @@ export function ProbBar(props: { contract: Contract; previewProb?: number }) { ) } -export function quickOutcome(contract: Contract, direction: 'UP' | 'DOWN') { +function quickOutcome(contract: Contract, direction: 'UP' | 'DOWN') { const { outcomeType } = contract if (outcomeType === 'BINARY' || outcomeType === 'PSEUDO_NUMERIC') {