From e7ed893b788fd34ebd22ad01d35f9197f09766d4 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Sat, 17 Sep 2022 18:45:40 -0500 Subject: [PATCH] Round prob in Daily movers --- web/components/bets-list.tsx | 7 +++++-- web/components/contract/prob-change-table.tsx | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 9c76174b..97d11758 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -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) + + '%'} ) } diff --git a/web/components/contract/prob-change-table.tsx b/web/components/contract/prob-change-table.tsx index 8a3ed87f..644946c9 100644 --- a/web/components/contract/prob-change-table.tsx +++ b/web/components/contract/prob-change-table.tsx @@ -77,10 +77,10 @@ export function ProbChange(props: { } = contract return ( - + {formatPercent(Math.round(100 * prob) / 100)} - + ) }