Round prob in Daily movers

This commit is contained in:
James Grugett 2022-09-17 18:45:40 -05:00
parent 8f30ef38d9
commit e7ed893b78
2 changed files with 7 additions and 4 deletions

View File

@ -756,9 +756,10 @@ function SellButton(props: {
export function ProfitBadge(props: {
profitPercent: number
round?: boolean
className?: string
}) {
const { profitPercent, className } = props
const { profitPercent, round, className } = props
if (!profitPercent) return null
const colors =
profitPercent > 0
@ -773,7 +774,9 @@ export function ProfitBadge(props: {
className
)}
>
{(profitPercent > 0 ? '+' : '') + profitPercent.toFixed(1) + '%'}
{(profitPercent > 0 ? '+' : '') +
profitPercent.toFixed(round ? 0 : 1) +
'%'}
</span>
)
}

View File

@ -77,10 +77,10 @@ export function ProbChange(props: {
} = contract
return (
<Col className={clsx('flex flex-col items-end', className)}>
<span className="mr-1.5 mb-0.5 text-2xl">
<span className="mb-0.5 mr-0.5 text-2xl">
{formatPercent(Math.round(100 * prob) / 100)}
</span>
<ProfitBadge className="ml-0" profitPercent={100 * change} />
<ProfitBadge className="ml-0" profitPercent={100 * change} round />
</Col>
)
}