diff --git a/web/components/amount-input.tsx b/web/components/amount-input.tsx
index 2ad745a8..ba9ad4a6 100644
--- a/web/components/amount-input.tsx
+++ b/web/components/amount-input.tsx
@@ -6,6 +6,7 @@ import { Col } from './layout/col'
import { SiteLink } from './site-link'
import { ENV_CONFIG } from 'common/envs/constants'
import { useWindowSize } from 'web/hooks/use-window-size'
+import { Row } from './layout/row'
export function AmountInput(props: {
amount: number | undefined
@@ -34,46 +35,58 @@ export function AmountInput(props: {
const isInvalid = !str || isNaN(amount)
onChange(isInvalid ? undefined : amount)
}
+
const { width } = useWindowSize()
const isMobile = (width ?? 0) < 768
return (
-
-
+ <>
+
+
- {error && (
-
- {error === 'Insufficient balance' ? (
- <>
- Not enough funds.
-
- Buy more?
-
- >
- ) : (
- error
- )}
-
- )}
-
+ {error && (
+
+ {error === 'Insufficient balance' ? (
+ <>
+ Not enough funds.
+
+ Buy more?
+
+ >
+ ) : (
+ error
+ )}
+
+ )}
+
+ >
)
}
@@ -136,27 +149,29 @@ export function BuyAmountInput(props: {
return (
<>
-
- {showSlider && (
- onAmountChange(parseRaw(parseInt(e.target.value)))}
- className="range range-lg only-thumb z-40 mb-2 xl:hidden"
- step="5"
+
+
- )}
+ {showSlider && (
+ onAmountChange(parseRaw(parseInt(e.target.value)))}
+ className="range range-lg only-thumb z-40 my-auto align-middle xl:hidden"
+ step="5"
+ />
+ )}
+
>
)
}
diff --git a/web/components/answers/answer-bet-panel.tsx b/web/components/answers/answer-bet-panel.tsx
index 3339ded5..4b31713c 100644
--- a/web/components/answers/answer-bet-panel.tsx
+++ b/web/components/answers/answer-bet-panel.tsx
@@ -182,9 +182,10 @@ export function AnswerBetPanel(props: {
-
+ {console.log('bet Amount pre', betAmount)}
{user ? (
- {/* */}
- {/*
-
-
-
*/}
/>
+
>
)
diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx
index 3cd5e167..e3fd2e16 100644
--- a/web/components/bet-panel.tsx
+++ b/web/components/bet-panel.tsx
@@ -1,6 +1,6 @@
import clsx from 'clsx'
import React, { useState } from 'react'
-import { clamp, partition, sumBy } from 'lodash'
+import { clamp, floor, partition, sumBy } from 'lodash'
import { useUser } from 'web/hooks/use-user'
import { CPMMBinaryContract, PseudoNumericContract } from 'common/contract'
@@ -43,6 +43,11 @@ import { PlayMoneyDisclaimer } from './play-money-disclaimer'
import { isAndroid, isIOS } from 'web/lib/util/device'
import { WarningConfirmationButton } from './warning-confirmation-button'
import { MarketIntroPanel } from './market-intro-panel'
+import { Modal } from './layout/modal'
+import { Title } from './title'
+import toast from 'react-hot-toast'
+import { CheckIcon } from '@heroicons/react/solid'
+import { useWindowSize } from 'web/hooks/use-window-size'
export function BetPanel(props: {
contract: CPMMBinaryContract | PseudoNumericContract
@@ -116,6 +121,8 @@ export function SimpleBetPanel(props: {
const unfilledBets = useUnfilledBets(contract.id) ?? []
+ console.log('limit order', isLimitOrder)
+
return (
void
+ onAdvanced?: () => void
mobileView?: boolean
}) {
const {
@@ -178,14 +186,21 @@ export function BuyPanel(props: {
hidden,
selected,
onBuySuccess,
+ onAdvanced,
mobileView,
} = props
const initialProb = getProbability(contract)
const isPseudoNumeric = contract.outcomeType === 'PSEUDO_NUMERIC'
- const [outcome, setOutcome] = useState<'YES' | 'NO' | undefined>(selected)
- const [betAmount, setBetAmount] = useState(undefined)
+ const windowSize = useWindowSize()
+ const initialOutcome =
+ windowSize.width && windowSize.width >= 1280 ? 'YES' : undefined
+ console.log('initialOutcome>', initialOutcome)
+ const [outcome, setOutcome] = useState<'YES' | 'NO' | undefined>(
+ initialOutcome
+ )
+ const [betAmount, setBetAmount] = useState(10)
const [error, setError] = useState()
const [isSubmitting, setIsSubmitting] = useState(false)
const [wasSubmitted, setWasSubmitted] = useState(false)
@@ -239,6 +254,11 @@ export function BuyPanel(props: {
setWasSubmitted(true)
setBetAmount(undefined)
if (onBuySuccess) onBuySuccess()
+ else {
+ toast('Trade submitted!', {
+ icon: ,
+ })
+ }
})
.catch((e) => {
if (e instanceof APIError) {
@@ -271,6 +291,7 @@ export function BuyPanel(props: {
unfilledBets as LimitBet[]
)
+ const [seeLimit, setSeeLimit] = useState(false)
const resultProb = getCpmmProbability(newPool, newP)
const probStayedSame =
formatPercent(resultProb) === formatPercent(initialProb)
@@ -305,9 +326,6 @@ export function BuyPanel(props: {
{!mobileView && (
<>
-
- {isPseudoNumeric ? 'Direction' : 'Outcome'}
-
-
+
+
+
+
+ {isPseudoNumeric ? (
+ 'Max payout'
+ ) : (
+ <>Payout if {outcome ?? 'YES'}>
+ )}
+
+
+
+
+ {formatMoney(currentPayout)}
+
+
+ {' '}
+ +{currentReturnPercent}
+
+
+
+
+
+ {isPseudoNumeric ? 'Estimated value' : 'New Probability'}
+
+ {probStayedSame ? (
+ {format(initialProb)}
+ ) : (
+
+ {format(resultProb)}
+
+ {' '}
+ {outcome != 'NO' && '+'}
+ {format(resultProb - initialProb)}
+
+
+ )}
+
+
+
Amount
{/*
Balance: {formatMoney(user?.balance ?? 0)}
@@ -358,63 +421,47 @@ export function BuyPanel(props: {
showSliderOnMobile
/>
-
-
-
- {isPseudoNumeric ? 'Estimated value' : 'Probability'}
-
- {probStayedSame ? (
- {format(initialProb)}
- ) : (
-
- {format(initialProb)}
- →
- {format(resultProb)}
-
- )}
-
-
-
-
-
- {isPseudoNumeric ? (
- 'Max payout'
- ) : (
- <>
- Payout if
- >
- )}
-
-
-
-
- {formatMoney(currentPayout)}
-
- (+{currentReturnPercent})
-
-
-
-
{user && (
)}
- {wasSubmitted && Trade submitted!
}
+ {/* {wasSubmitted && Trade submitted!
} */}
+
+
+
+
+
)
@@ -915,11 +962,7 @@ export function SellPanel(props: {
<>
YES
+ return YES
}
export function HigherLabel() {
diff --git a/web/components/warning-confirmation-button.tsx b/web/components/warning-confirmation-button.tsx
index 7b707098..4885c58e 100644
--- a/web/components/warning-confirmation-button.tsx
+++ b/web/components/warning-confirmation-button.tsx
@@ -4,8 +4,10 @@ import React from 'react'
import { Row } from './layout/row'
import { ConfirmationButton } from './confirmation-button'
import { ExclamationIcon } from '@heroicons/react/solid'
+import { formatMoney } from 'common/util/format'
export function WarningConfirmationButton(props: {
+ amount: number | undefined
warning?: string
onSubmit: () => void
disabled?: boolean
@@ -14,6 +16,7 @@ export function WarningConfirmationButton(props: {
submitButtonClassName?: string
}) {
const {
+ amount,
onSubmit,
warning,
disabled,
@@ -31,9 +34,12 @@ export function WarningConfirmationButton(props: {
disabled && 'btn-disabled'
)}
onClick={onSubmit}
- disabled={disabled}
>
- {isSubmitting ? 'Submitting...' : 'Submit'}
+ {isSubmitting
+ ? 'Submitting...'
+ : amount
+ ? `Wager ${formatMoney(amount)}`
+ : 'Wager'}
)
}
@@ -45,7 +51,7 @@ export function WarningConfirmationButton(props: {
openModalButtonClass,
isSubmitting && 'btn-disabled loading'
),
- label: 'Submit',
+ label: amount ? `Wager ${formatMoney(amount)}` : 'Wager',
}}
cancelBtn={{
label: 'Cancel',
diff --git a/web/components/yes-no-selector.tsx b/web/components/yes-no-selector.tsx
index ccd93d87..f73cdef2 100644
--- a/web/components/yes-no-selector.tsx
+++ b/web/components/yes-no-selector.tsx
@@ -38,7 +38,7 @@ export function YesNoSelector(props: {
selected == 'YES'
? 'border-teal-500 bg-teal-500 text-white'
: selected == 'NO'
- ? 'border-greyscale-3 text-greyscale-3 bg-white'
+ ? 'border-greyscale-3 text-greyscale-3 bg-white hover:border-teal-500 hover:text-teal-500'
: 'border-teal-500 bg-white text-teal-500 hover:bg-teal-50',
btnClassName
)}
@@ -54,10 +54,10 @@ export function YesNoSelector(props: {
className={clsx(
commonClassNames,
selected == 'NO'
- ? 'border-red-500 bg-red-500 text-white'
+ ? 'border-red-400 bg-red-400 text-white'
: selected == 'YES'
- ? 'border-greyscale-3 text-greyscale-3 bg-white'
- : 'border-red-500 bg-white text-red-500 hover:bg-red-50',
+ ? 'border-greyscale-3 text-greyscale-3 bg-white hover:border-red-400 hover:text-red-400'
+ : 'border-red-400 bg-white text-red-400 hover:bg-red-50',
btnClassName
)}
onClick={() => onSelect('NO')}
diff --git a/web/tailwind.config.js b/web/tailwind.config.js
index 7bea3ec2..9de3f954 100644
--- a/web/tailwind.config.js
+++ b/web/tailwind.config.js
@@ -19,6 +19,7 @@ module.exports = {
'world-trading': "url('/world-trading-background.webp')",
},
colors: {
+ 'red-25': '#FDF7F6',
'greyscale-1': '#FBFBFF',
'greyscale-2': '#E7E7F4',
'greyscale-3': '#D8D8EB',