Skip to content

Commit 98a90f9

Browse files
ArslanYMvacekjbard
authored
fix: fixed avg contribution calc + NaN state display on Manager (gitcoinco#2331)
Co-authored-by: Atris <vacekj@outlook.com> Co-authored-by: Massimiliano Mirra <max@gitcoin.co>
1 parent 7beb55a commit 98a90f9

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

packages/round-manager/src/features/round/ViewRoundStats.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ export default function ViewRoundStats() {
5050
<StatsCard
5151
text={
5252
round &&
53-
`${utils.formatUnits(round.matchAmount, matchToken?.decimal)} ${
54-
matchToken?.name
53+
`${utils.formatUnits(round.matchAmount, matchToken?.decimal)} ${matchToken?.name
5554
}`
5655
}
5756
title={"Matching Funds Available"}
@@ -126,11 +125,12 @@ export default function ViewRoundStats() {
126125
grayBorder={true}
127126
title="Avg. Contribution"
128127
text={
129-
round &&
130-
new Intl.NumberFormat("en-US", {
131-
style: "currency",
132-
currency: "USD",
133-
}).format(round.amountUSD / round.uniqueContributors)
128+
round && round.uniqueContributors > 0
129+
? new Intl.NumberFormat("en-US", {
130+
style: "currency",
131+
currency: "USD",
132+
}).format(round.amountUSD / round.uniqueContributors)
133+
: "N/A"
134134
}
135135
/>
136136
<StatsCard
@@ -153,9 +153,8 @@ type StatsCardProps = {
153153
function StatsCard(props: StatsCardProps) {
154154
return (
155155
<div
156-
className={`p-4 border rounded ${
157-
props.grayBorder ? "border-grey-100" : "border-violet-400"
158-
} flex flex-col justify-center`}
156+
className={`p-4 border rounded ${props.grayBorder ? "border-grey-100" : "border-violet-400"
157+
} flex flex-col justify-center`}
159158
>
160159
<span
161160
className={

0 commit comments

Comments
 (0)