linting
This commit is contained in:
parent
ff6ce54b4b
commit
4bf7af07e1
|
@ -2,11 +2,7 @@ import { useState } from 'react'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
|
|
||||||
import { BuyPanel, SimpleBetPanel } from './bet-panel'
|
import { BuyPanel, SimpleBetPanel } from './bet-panel'
|
||||||
import {
|
import { CPMMBinaryContract, PseudoNumericContract } from 'common/contract'
|
||||||
BinaryContract,
|
|
||||||
CPMMBinaryContract,
|
|
||||||
PseudoNumericContract,
|
|
||||||
} from 'common/contract'
|
|
||||||
import { Modal } from './layout/modal'
|
import { Modal } from './layout/modal'
|
||||||
import { useUser } from 'web/hooks/use-user'
|
import { useUser } from 'web/hooks/use-user'
|
||||||
import { useUserContractBets } from 'web/hooks/use-user-bets'
|
import { useUserContractBets } from 'web/hooks/use-user-bets'
|
||||||
|
@ -15,7 +11,6 @@ import { Col } from './layout/col'
|
||||||
import { Button } from 'web/components/button'
|
import { Button } from 'web/components/button'
|
||||||
import { BetSignUpPrompt } from './sign-up-prompt'
|
import { BetSignUpPrompt } from './sign-up-prompt'
|
||||||
import { PRESENT_BET } from 'common/user'
|
import { PRESENT_BET } from 'common/user'
|
||||||
import { Contract } from 'web/lib/firebase/contracts'
|
|
||||||
import { User } from 'web/lib/firebase/users'
|
import { User } from 'web/lib/firebase/users'
|
||||||
import { SellRow } from './sell-row'
|
import { SellRow } from './sell-row'
|
||||||
import { useUnfilledBets } from 'web/hooks/use-bets'
|
import { useUnfilledBets } from 'web/hooks/use-bets'
|
||||||
|
|
|
@ -3,11 +3,7 @@ import React, { useState } from 'react'
|
||||||
import { clamp, partition, sumBy } from 'lodash'
|
import { clamp, partition, sumBy } from 'lodash'
|
||||||
|
|
||||||
import { useUser } from 'web/hooks/use-user'
|
import { useUser } from 'web/hooks/use-user'
|
||||||
import {
|
import { CPMMBinaryContract, PseudoNumericContract } from 'common/contract'
|
||||||
Contract,
|
|
||||||
CPMMBinaryContract,
|
|
||||||
PseudoNumericContract,
|
|
||||||
} from 'common/contract'
|
|
||||||
import { Col } from './layout/col'
|
import { Col } from './layout/col'
|
||||||
import { Row } from './layout/row'
|
import { Row } from './layout/row'
|
||||||
import { Spacer } from './layout/spacer'
|
import { Spacer } from './layout/spacer'
|
||||||
|
@ -114,11 +110,10 @@ export function BetPanel(props: {
|
||||||
export function SimpleBetPanel(props: {
|
export function SimpleBetPanel(props: {
|
||||||
contract: CPMMBinaryContract | PseudoNumericContract
|
contract: CPMMBinaryContract | PseudoNumericContract
|
||||||
className?: string
|
className?: string
|
||||||
selected?: 'YES' | 'NO'
|
|
||||||
hasShares?: boolean
|
hasShares?: boolean
|
||||||
onBetSuccess?: () => void
|
onBetSuccess?: () => void
|
||||||
}) {
|
}) {
|
||||||
const { contract, className, selected, hasShares, onBetSuccess } = props
|
const { contract, className, hasShares, onBetSuccess } = props
|
||||||
|
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
const [isLimitOrder, setIsLimitOrder] = useState(false)
|
const [isLimitOrder, setIsLimitOrder] = useState(false)
|
||||||
|
@ -196,13 +191,11 @@ export function BuyPanel(props: {
|
||||||
const [betAmount, setBetAmount] = useState<number | undefined>(10)
|
const [betAmount, setBetAmount] = useState<number | undefined>(10)
|
||||||
const [error, setError] = useState<string | undefined>()
|
const [error, setError] = useState<string | undefined>()
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||||
const [wasSubmitted, setWasSubmitted] = useState(false)
|
|
||||||
|
|
||||||
const [inputRef, focusAmountInput] = useFocus()
|
const [inputRef, focusAmountInput] = useFocus()
|
||||||
|
|
||||||
function onBetChoice(choice: 'YES' | 'NO') {
|
function onBetChoice(choice: 'YES' | 'NO') {
|
||||||
setOutcome(choice)
|
setOutcome(choice)
|
||||||
setWasSubmitted(false)
|
|
||||||
|
|
||||||
if (!isIOS() && !isAndroid()) {
|
if (!isIOS() && !isAndroid()) {
|
||||||
focusAmountInput()
|
focusAmountInput()
|
||||||
|
@ -215,15 +208,12 @@ export function BuyPanel(props: {
|
||||||
} else {
|
} else {
|
||||||
setOutcome(choice)
|
setOutcome(choice)
|
||||||
}
|
}
|
||||||
setWasSubmitted(false)
|
|
||||||
|
|
||||||
if (!isIOS() && !isAndroid()) {
|
if (!isIOS() && !isAndroid()) {
|
||||||
focusAmountInput()
|
focusAmountInput()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBetChange(newAmount: number | undefined) {
|
function onBetChange(newAmount: number | undefined) {
|
||||||
setWasSubmitted(false)
|
|
||||||
setBetAmount(newAmount)
|
setBetAmount(newAmount)
|
||||||
if (!outcome) {
|
if (!outcome) {
|
||||||
setOutcome('YES')
|
setOutcome('YES')
|
||||||
|
@ -244,7 +234,6 @@ export function BuyPanel(props: {
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
console.log('placed bet. Result:', r)
|
console.log('placed bet. Result:', r)
|
||||||
setIsSubmitting(false)
|
setIsSubmitting(false)
|
||||||
setWasSubmitted(true)
|
|
||||||
setBetAmount(undefined)
|
setBetAmount(undefined)
|
||||||
if (onBuySuccess) onBuySuccess()
|
if (onBuySuccess) onBuySuccess()
|
||||||
else {
|
else {
|
||||||
|
@ -439,8 +428,6 @@ export function BuyPanel(props: {
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* {wasSubmitted && <div className="mt-4">Trade submitted!</div>} */}
|
|
||||||
<button
|
<button
|
||||||
className="text-greyscale-6 mx-auto select-none text-sm underline xl:hidden"
|
className="text-greyscale-6 mx-auto select-none text-sm underline xl:hidden"
|
||||||
onClick={() => setSeeLimit(true)}
|
onClick={() => setSeeLimit(true)}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import BetButton, { BinaryMobileBetting } from '../bet-button'
|
||||||
import { AnswersGraph } from '../answers/answers-graph'
|
import { AnswersGraph } from '../answers/answers-graph'
|
||||||
import {
|
import {
|
||||||
Contract,
|
Contract,
|
||||||
BinaryContract,
|
|
||||||
CPMMContract,
|
CPMMContract,
|
||||||
FreeResponseContract,
|
FreeResponseContract,
|
||||||
MultipleChoiceContract,
|
MultipleChoiceContract,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user