From ce7e8900a1bdc12e4ef0a275dfb855241e4b7809 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Sun, 20 Mar 2022 12:27:11 -0500 Subject: [PATCH] Buy and sell tabs. Compute some sell info --- web/components/amount-input.tsx | 111 ++++++++++++++++++++++--- web/components/bet-panel.tsx | 129 ++++++++++++++++++++++------- web/components/yes-no-selector.tsx | 15 ++-- 3 files changed, 210 insertions(+), 45 deletions(-) diff --git a/web/components/amount-input.tsx b/web/components/amount-input.tsx index 50d00f88..c5fa839a 100644 --- a/web/components/amount-input.tsx +++ b/web/components/amount-input.tsx @@ -4,15 +4,17 @@ import { useUser } from '../hooks/use-user' import { formatMoney } from '../../common/util/format' import { Col } from './layout/col' import { Row } from './layout/row' -import { useUserContractBets } from '../hooks/use-user-bets' -import { MAX_LOAN_PER_CONTRACT } from '../../common/bet' +import { Bet, MAX_LOAN_PER_CONTRACT } from '../../common/bet' import { InfoTooltip } from './info-tooltip' import { Spacer } from './layout/spacer' +import { calculateCpmmSale } from '../../common/calculate-cpmm' +import { Binary, CPMM, FullContract } from '../../common/contract' export function AmountInput(props: { amount: number | undefined onChange: (newAmount: number | undefined) => void error: string | undefined + label: string disabled?: boolean className?: string inputClassName?: string @@ -24,6 +26,7 @@ export function AmountInput(props: { amount, onChange, error, + label, disabled, className, inputClassName, @@ -47,7 +50,7 @@ export function AmountInput(props: { return (