diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index 7188c19a..8aa8b60a 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -405,7 +405,7 @@ function QuickOrLimitBet(props: { return (
Bet
- + { diff --git a/web/components/layout/modal.tsx b/web/components/layout/modal.tsx index 7a320f24..af2b66de 100644 --- a/web/components/layout/modal.tsx +++ b/web/components/layout/modal.tsx @@ -7,9 +7,17 @@ export function Modal(props: { children: ReactNode open: boolean setOpen: (open: boolean) => void + size?: 'sm' | 'md' | 'lg' | 'xl' className?: string }) { - const { children, open, setOpen, className } = props + const { children, open, setOpen, size = 'md', className } = props + + const sizeClass = { + sm: 'max-w-sm', + md: 'max-w-md', + lg: 'max-w-2xl', + xl: 'max-w-5xl', + }[size] return ( @@ -49,7 +57,8 @@ export function Modal(props: { >
diff --git a/web/components/limit-bets.tsx b/web/components/limit-bets.tsx index 93647a5e..29d010e2 100644 --- a/web/components/limit-bets.tsx +++ b/web/components/limit-bets.tsx @@ -1,4 +1,3 @@ -import clsx from 'clsx' import { LimitBet } from 'common/bet' import { CPMMBinaryContract, PseudoNumericContract } from 'common/contract' import { getFormattedMappedValue } from 'common/pseudo-numeric' @@ -8,10 +7,14 @@ import { useState } from 'react' import { useUser, useUserById } from 'web/hooks/use-user' import { cancelBet } from 'web/lib/firebase/api' import { Avatar } from './avatar' +import { Button } from './button' import { Col } from './layout/col' -import { Tabs } from './layout/tabs' +import { Modal } from './layout/modal' +import { Row } from './layout/row' import { LoadingIndicator } from './loading-indicator' import { BinaryOutcomeLabel, PseudoNumericOutcomeLabel } from './outcome-label' +import { Subtitle } from './subtitle' +import { Title } from './title' export function LimitBets(props: { contract: CPMMBinaryContract | PseudoNumericContract @@ -28,40 +31,36 @@ export function LimitBets(props: { const yourBets = sortedBets.filter((bet) => bet.userId === user?.id) return ( - + {yourBets.length === 0 && ( + + )} + + {yourBets.length > 0 && ( + + + + + + + + + )} - > - 0 - ? [ - { - title: 'Your limit orders', - content: ( - - ), - }, - ] - : []), - { - title: 'All limit orders', - content: ( - - ), - }, - ]} - /> ) } @@ -153,3 +152,46 @@ function LimitBet(props: { ) } + +export function OrderBookButton(props: { + limitBets: LimitBet[] + contract: CPMMBinaryContract | PseudoNumericContract + className?: string +}) { + const { limitBets, contract, className } = props + const [open, setOpen] = useState(false) + + const yesBets = limitBets.filter((bet) => bet.outcome === 'YES') + const noBets = limitBets.filter((bet) => bet.outcome === 'NO').reverse() + + return ( + <> + + + + + + <Col className="justify-start gap-2 lg:flex-row lg:items-start"> + <LimitOrderTable + limitBets={yesBets} + contract={contract} + isYou={false} + /> + <LimitOrderTable + limitBets={noBets} + contract={contract} + isYou={false} + /> + </Col> + </Col> + </Modal> + </> + ) +}