Show absolute prob in daily movers as well
This commit is contained in:
parent
a54f060ccb
commit
b74fd57912
|
@ -6,6 +6,7 @@ import { SiteLink } from '../site-link'
|
||||||
import { Col } from '../layout/col'
|
import { Col } from '../layout/col'
|
||||||
import { Row } from '../layout/row'
|
import { Row } from '../layout/row'
|
||||||
import { LoadingIndicator } from '../loading-indicator'
|
import { LoadingIndicator } from '../loading-indicator'
|
||||||
|
import { ProfitBadge } from '../bets-list'
|
||||||
|
|
||||||
export function ProbChangeTable(props: {
|
export function ProbChangeTable(props: {
|
||||||
changes:
|
changes:
|
||||||
|
@ -54,14 +55,14 @@ export function ProbChangeTable(props: {
|
||||||
function ProbChangeRow(props: { contract: CPMMContract }) {
|
function ProbChangeRow(props: { contract: CPMMContract }) {
|
||||||
const { contract } = props
|
const { contract } = props
|
||||||
return (
|
return (
|
||||||
<Row className="items-center hover:bg-gray-100">
|
<Row className="items-center gap-4 hover:bg-gray-100">
|
||||||
<ProbChange className="p-4 text-right text-xl" contract={contract} />
|
|
||||||
<SiteLink
|
<SiteLink
|
||||||
className="p-4 pl-2 font-semibold text-indigo-700"
|
className="p-4 pr-0 font-semibold text-indigo-700"
|
||||||
href={contractPath(contract)}
|
href={contractPath(contract)}
|
||||||
>
|
>
|
||||||
<span className="line-clamp-2">{contract.question}</span>
|
<span className="line-clamp-2">{contract.question}</span>
|
||||||
</SiteLink>
|
</SiteLink>
|
||||||
|
<ProbChange className="py-2 pr-4 text-xl" contract={contract} />
|
||||||
</Row>
|
</Row>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -72,19 +73,15 @@ export function ProbChange(props: {
|
||||||
}) {
|
}) {
|
||||||
const { contract, className } = props
|
const { contract, className } = props
|
||||||
const {
|
const {
|
||||||
|
prob,
|
||||||
probChanges: { day: change },
|
probChanges: { day: change },
|
||||||
} = contract
|
} = contract
|
||||||
|
return (
|
||||||
const color =
|
<Col className={clsx('flex flex-col items-end', className)}>
|
||||||
change > 0
|
<span className="mr-1.5 mb-0.5 text-2xl">
|
||||||
? 'text-green-500'
|
{formatPercent(Math.round(100 * prob) / 100)}
|
||||||
: change < 0
|
</span>
|
||||||
? 'text-red-500'
|
<ProfitBadge className="ml-0" profitPercent={100 * change} />
|
||||||
: 'text-gray-600'
|
</Col>
|
||||||
|
)
|
||||||
const str =
|
|
||||||
change === 0
|
|
||||||
? '+0%'
|
|
||||||
: `${change > 0 ? '+' : '-'}${formatPercent(Math.abs(change))}`
|
|
||||||
return <div className={clsx(className, color)}>{str}</div>
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user