diff --git a/common/payouts-dpm.ts b/common/payouts-dpm.ts index 7d4a0185..bf6f5ebc 100644 --- a/common/payouts-dpm.ts +++ b/common/payouts-dpm.ts @@ -13,7 +13,6 @@ import { addObjects } from './util/object' export const getDpmCancelPayouts = (contract: DPMContract, bets: Bet[]) => { const { pool } = contract const poolTotal = sum(Object.values(pool)) - console.log('resolved N/A, pool M$', poolTotal) const betSum = sumBy(bets, (b) => b.amount) @@ -58,17 +57,6 @@ export const getDpmStandardPayouts = ( liquidityFee: 0, }) - console.log( - 'resolved', - outcome, - 'pool', - poolTotal, - 'profits', - profits, - 'creator fee', - creatorFee - ) - return { payouts: payouts.map(({ userId, payout }) => ({ userId, payout })), creatorPayout: creatorFee, @@ -110,17 +98,6 @@ export const getNumericDpmPayouts = ( liquidityFee: 0, }) - console.log( - 'resolved numeric bucket: ', - outcome, - 'pool', - poolTotal, - 'profits', - profits, - 'creator fee', - creatorFee - ) - return { payouts: payouts.map(({ userId, payout }) => ({ userId, payout })), creatorPayout: creatorFee, @@ -163,17 +140,6 @@ export const getDpmMktPayouts = ( liquidityFee: 0, }) - console.log( - 'resolved MKT', - p, - 'pool', - pool, - 'profits', - profits, - 'creator fee', - creatorFee - ) - return { payouts: payouts.map(({ userId, payout }) => ({ userId, payout })), creatorPayout: creatorFee, @@ -216,16 +182,6 @@ export const getPayoutsMultiOutcome = ( liquidityFee: 0, }) - console.log( - 'resolved', - resolutions, - 'pool', - poolTotal, - 'profits', - profits, - 'creator fee', - creatorFee - ) return { payouts: payouts.map(({ userId, payout }) => ({ userId, payout })), creatorPayout: creatorFee, diff --git a/common/payouts-fixed.ts b/common/payouts-fixed.ts index 4b8de85a..99e03fac 100644 --- a/common/payouts-fixed.ts +++ b/common/payouts-fixed.ts @@ -1,4 +1,3 @@ -import { sum } from 'lodash' import { Bet } from './bet' import { getProbability } from './calculate' @@ -43,18 +42,6 @@ export const getStandardFixedPayouts = ( const { collectedFees } = contract const creatorPayout = collectedFees.creatorFee - - console.log( - 'resolved', - outcome, - 'pool', - contract.pool[outcome], - 'payouts', - sum(payouts), - 'creator fee', - creatorPayout - ) - const liquidityPayouts = getLiquidityPoolPayouts( contract, outcome, @@ -98,18 +85,6 @@ export const getMktFixedPayouts = ( const { collectedFees } = contract const creatorPayout = collectedFees.creatorFee - - console.log( - 'resolved PROB', - p, - 'pool', - p * contract.pool.YES + (1 - p) * contract.pool.NO, - 'payouts', - sum(payouts), - 'creator fee', - creatorPayout - ) - const liquidityPayouts = getLiquidityPoolProbPayouts(contract, p, liquidities) return { payouts, creatorPayout, liquidityPayouts, collectedFees } diff --git a/web/components/answers/answer-bet-panel.tsx b/web/components/answers/answer-bet-panel.tsx index f84ff1a3..3339ded5 100644 --- a/web/components/answers/answer-bet-panel.tsx +++ b/web/components/answers/answer-bet-panel.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx' -import React, { useEffect, useRef, useState } from 'react' +import React, { useState } from 'react' import { XIcon } from '@heroicons/react/solid' import { Answer } from 'common/answer' @@ -25,7 +25,6 @@ import { import { Bet } from 'common/bet' import { track } from 'web/lib/service/analytics' import { BetSignUpPrompt } from '../sign-up-prompt' -import { isIOS } from 'web/lib/util/device' import { WarningConfirmationButton } from '../warning-confirmation-button' export function AnswerBetPanel(props: { @@ -44,12 +43,6 @@ export function AnswerBetPanel(props: { const [error, setError] = useState() const [isSubmitting, setIsSubmitting] = useState(false) - const inputRef = useRef(null) - useEffect(() => { - if (isIOS()) window.scrollTo(0, window.scrollY + 200) - inputRef.current && inputRef.current.focus() - }, []) - async function submitBet() { if (!user || !betAmount) return @@ -117,7 +110,7 @@ export function AnswerBetPanel(props: { const bankrollFraction = (betAmount ?? 0) / (user?.balance ?? 1e9) const warning = - (betAmount ?? 0) > 10 && bankrollFraction >= 0.5 && bankrollFraction <= 1 + (betAmount ?? 0) >= 100 && bankrollFraction >= 0.5 && bankrollFraction <= 1 ? `You might not want to spend ${formatPercent( bankrollFraction )} of your balance on a single bet. \n\nCurrent balance: ${formatMoney( @@ -153,7 +146,6 @@ export function AnswerBetPanel(props: { error={error} setError={setError} disabled={isSubmitting} - inputRef={inputRef} showSliderOnMobile /> diff --git a/web/components/answers/answers-panel.tsx b/web/components/answers/answers-panel.tsx index e53153b1..5811403f 100644 --- a/web/components/answers/answers-panel.tsx +++ b/web/components/answers/answers-panel.tsx @@ -194,7 +194,7 @@ function OpenAnswer(props: { return ( - + - + 10 && bankrollFraction >= 0.5 && bankrollFraction <= 1 + (betAmount ?? 0) >= 100 && bankrollFraction >= 0.5 && bankrollFraction <= 1 ? `You might not want to spend ${formatPercent( bankrollFraction )} of your balance on a single trade. \n\nCurrent balance: ${formatMoney( diff --git a/web/components/layout/modal.tsx b/web/components/layout/modal.tsx index d1a65607..435286ca 100644 --- a/web/components/layout/modal.tsx +++ b/web/components/layout/modal.tsx @@ -8,9 +8,10 @@ export function Modal(props: { open: boolean setOpen: (open: boolean) => void size?: 'sm' | 'md' | 'lg' | 'xl' + position?: 'center' | 'top' | 'bottom' className?: string }) { - const { children, open, setOpen, size = 'md', className } = props + const { children, position, open, setOpen, size = 'md', className } = props const sizeClass = { sm: 'max-w-sm', @@ -19,6 +20,12 @@ export function Modal(props: { xl: 'max-w-5xl', }[size] + const positionClass = { + center: 'items-center', + top: 'items-start', + bottom: 'items-end', + }[position ?? 'bottom'] + return ( -
+
(