From f800570845806da5e90cd5339e89f0aedbac3f4a Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 22 Jul 2022 16:03:52 -0500 Subject: [PATCH] Improve range limit order UI --- web/components/bet-panel.tsx | 37 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index 7d2b1e5a..064be0be 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -20,7 +20,13 @@ import { APIError, placeBet } from 'web/lib/firebase/api' import { sellShares } from 'web/lib/firebase/api' import { AmountInput, BuyAmountInput } from './amount-input' import { InfoTooltip } from './info-tooltip' -import { BinaryOutcomeLabel, HigherLabel, LowerLabel } from './outcome-label' +import { + BinaryOutcomeLabel, + HigherLabel, + LowerLabel, + NoLabel, + YesLabel, +} from './outcome-label' import { getProbability } from 'common/calculate' import { useFocus } from 'web/hooks/use-focus' import { useUserContractBets } from 'web/hooks/use-user-bets' @@ -366,12 +372,12 @@ function LimitOrderPanel(props: { (highLimitProb !== undefined && (highLimitProb <= 0 || highLimitProb >= 100)) - const initialLow = initialProb * 0.9 - const initialHigh = initialProb + (1 - initialProb) * 0.1 - const lowPlaceholder = Math.round( + const initialLow = initialProb * 0.85 + const initialHigh = initialProb + (1 - initialProb) * 0.15 + const lowPlaceholder = Math.floor( isPseudoNumeric ? getMappedValue(contract)(initialLow) : initialLow * 100 ).toString() - const highPlaceholder = Math.round( + const highPlaceholder = Math.ceil( isPseudoNumeric ? getMappedValue(contract)(initialHigh) : initialHigh * 100 ).toString() @@ -514,14 +520,11 @@ function LimitOrderPanel(props: { return ( -
- Bet when the {isPseudoNumeric ? 'value' : 'probability'} reaches Low - and/or High limit. -
- - + -
Low
+
+ Bet at +
-
High
+
+ Bet at +
- Low limit must be less than High limit + YES limit must be less than NO limit )} {outOfRangeError && ( @@ -574,7 +579,7 @@ function LimitOrderPanel(props: { ) : ( )}{' '} - current fill + filled now
{formatMoney(yesBet.amount)} of{' '} @@ -590,7 +595,7 @@ function LimitOrderPanel(props: { ) : ( )}{' '} - current fill + filled now
{formatMoney(noBet.amount)} of{' '}