Small fixes for limit order table

This commit is contained in:
James Grugett 2022-07-14 21:27:00 -05:00
parent 17c9beca28
commit 590c63e911
2 changed files with 14 additions and 12 deletions

View File

@ -45,7 +45,7 @@ import { useUnfilledBets } from 'web/hooks/use-bets'
import { LimitBet } from 'common/bet'
import { floatingEqual } from 'common/util/math'
import { Pagination } from './pagination'
import { LimitBets } from './limit-bets'
import { LimitOrderTable } from './limit-bets'
type BetSort = 'newest' | 'profit' | 'closeTime' | 'value'
type BetFilter = 'open' | 'limit_bet' | 'sold' | 'closed' | 'resolved' | 'all'
@ -364,18 +364,20 @@ function ContractBets(props: {
{contract.mechanism === 'cpmm-1' && limitBets.length > 0 && (
<>
<div className="bg-gray-50 px-4 py-2">Your limit orders</div>
<LimitBets
className="max-w-md px-2 py-0 sm:px-4"
contract={contract}
bets={limitBets}
hideLabel
/>
<div className="max-w-md">
<div className="bg-gray-50 px-4 py-2">Limit orders</div>
<LimitOrderTable
contract={contract}
limitBets={limitBets}
isYou={true}
/>
</div>
</>
)}
<Spacer h={4} />
<div className="bg-gray-50 px-4 py-2">Bets</div>
<ContractBetsTable
contract={contract}
bets={bets}

View File

@ -16,7 +16,6 @@ import { BinaryOutcomeLabel, PseudoNumericOutcomeLabel } from './outcome-label'
export function LimitBets(props: {
contract: CPMMBinaryContract | PseudoNumericContract
bets: LimitBet[]
hideLabel?: boolean
className?: string
}) {
const { contract, bets, className } = props
@ -67,20 +66,21 @@ export function LimitBets(props: {
)
}
function LimitOrderTable(props: {
export function LimitOrderTable(props: {
limitBets: LimitBet[]
contract: CPMMBinaryContract | PseudoNumericContract
isYou: boolean
}) {
const { limitBets, contract, isYou } = props
const isPseudoNumeric = contract.outcomeType === 'PSEUDO_NUMERIC'
return (
<table className="table-compact table w-full rounded text-gray-500">
<thead>
{!isYou && <th>User</th>}
{!isYou && <th></th>}
<th>Outcome</th>
<th>Amount</th>
<th>Prob</th>
<th>{isPseudoNumeric ? 'Value' : 'Prob'}</th>
{isYou && <th></th>}
</thead>
<tbody>