stats: show market type, payout mechanism
This commit is contained in:
parent
e34d34080d
commit
3d39b705ae
|
@ -21,6 +21,7 @@ import { ShareEmbedButton } from '../share-embed-button'
|
||||||
import { TagsInput } from '../tags-input'
|
import { TagsInput } from '../tags-input'
|
||||||
import { Title } from '../title'
|
import { Title } from '../title'
|
||||||
import { TweetButton } from '../tweet-button'
|
import { TweetButton } from '../tweet-button'
|
||||||
|
import { InfoTooltip } from '../info-tooltip'
|
||||||
|
|
||||||
export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) {
|
export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) {
|
||||||
const { contract, bets } = props
|
const { contract, bets } = props
|
||||||
|
@ -29,11 +30,20 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) {
|
||||||
|
|
||||||
const formatTime = (dt: number) => dayjs(dt).format('MMM DD, YYYY hh:mm a z')
|
const formatTime = (dt: number) => dayjs(dt).format('MMM DD, YYYY hh:mm a z')
|
||||||
|
|
||||||
const { createdTime, closeTime, resolutionTime } = contract
|
const { createdTime, closeTime, resolutionTime, mechanism, outcomeType } =
|
||||||
|
contract
|
||||||
|
|
||||||
const tradersCount = uniqBy(
|
const tradersCount = uniqBy(
|
||||||
bets.filter((bet) => !bet.isAnte),
|
bets.filter((bet) => !bet.isAnte),
|
||||||
'userId'
|
'userId'
|
||||||
).length
|
).length
|
||||||
|
|
||||||
|
const typeDisplay =
|
||||||
|
outcomeType === 'BINARY'
|
||||||
|
? 'YES / NO'
|
||||||
|
: outcomeType === 'FREE_RESPONSE'
|
||||||
|
? 'Free response'
|
||||||
|
: 'Numeric'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -69,8 +79,31 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) {
|
||||||
<div />
|
<div />
|
||||||
|
|
||||||
<div>Stats</div>
|
<div>Stats</div>
|
||||||
|
|
||||||
<table className="table-compact table-zebra table w-full text-gray-500">
|
<table className="table-compact table-zebra table w-full text-gray-500">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Type</td>
|
||||||
|
<td>{typeDisplay}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Payout</td>
|
||||||
|
<td>
|
||||||
|
{mechanism === 'cpmm-1' ? (
|
||||||
|
<>
|
||||||
|
Fixed{' '}
|
||||||
|
<InfoTooltip text="Each YES share is worth M$1 if YES wins." />
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<div>
|
||||||
|
Parimutuel{' '}
|
||||||
|
<InfoTooltip text="Each share is a fraction of the pool. " />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Market created</td>
|
<td>Market created</td>
|
||||||
<td>{formatTime(createdTime)}</td>
|
<td>{formatTime(createdTime)}</td>
|
||||||
|
@ -106,7 +139,9 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) {
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Pool</td>
|
<td>
|
||||||
|
{mechanism === 'cpmm-1' ? 'Liquidity pool' : 'Betting pool'}
|
||||||
|
</td>
|
||||||
<td>{contractPool(contract)}</td>
|
<td>{contractPool(contract)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user