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

View File

@ -77,10 +77,10 @@ export function ProbChange(props: {
} = contract } = contract
return ( return (
<Col className={clsx('flex flex-col items-end', className)}> <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)} {formatPercent(Math.round(100 * prob) / 100)}
</span> </span>
<ProfitBadge className="ml-0" profitPercent={100 * change} /> <ProfitBadge className="ml-0" profitPercent={100 * change} round />
</Col> </Col>
) )
} }