diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index ba19d41a..7653ba45 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -23,7 +23,7 @@ import { APIError, placeBet } from 'web/lib/firebase/api-call' import { sellShares } from 'web/lib/firebase/api-call' import { AmountInput, BuyAmountInput } from './amount-input' import { InfoTooltip } from './info-tooltip' -import { BinaryOutcomeLabel, PseudoNumericOutcomeLabel } from './outcome-label' +import { BinaryOutcomeLabel } from './outcome-label' import { getProbability } from 'common/calculate' import { useFocus } from 'web/hooks/use-focus' import { useUserContractBets } from 'web/hooks/use-user-bets' @@ -111,128 +111,43 @@ export function BetPanel(props: { ) } -export function BetPanelSwitcher(props: { +export function SimpleBetPanel(props: { contract: CPMMBinaryContract | PseudoNumericContract className?: string - title?: string // Set if BetPanel is on a feed modal selected?: 'YES' | 'NO' onBetSuccess?: () => void }) { - const { contract, className, title, selected, onBetSuccess } = props - - const { mechanism, outcomeType } = contract - const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC' + const { contract, className, selected, onBetSuccess } = props const user = useUser() - const userBets = useUserContractBets(user?.id, contract.id) const unfilledBets = useUnfilledBets(contract.id) ?? [] - - const [tradeType, setTradeType] = useState<'BUY' | 'SELL'>('BUY') const [isLimitOrder, setIsLimitOrder] = useState(false) - const { yesFloorShares, noFloorShares, yesShares, noShares } = useSaveShares( - contract, - userBets - ) - - const floorShares = yesFloorShares || noFloorShares - const sharesOutcome = yesFloorShares - ? 'YES' - : noFloorShares - ? 'NO' - : undefined - - useEffect(() => { - // Switch back to BUY if the user has sold all their shares. - if (tradeType === 'SELL' && sharesOutcome === undefined) { - setTradeType('BUY') - } - }, [tradeType, sharesOutcome]) - return (