Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Commit 2c12782

Browse files
authored
Merge pull request #737 from aibtcdev/fix-decimals
Fix decimals
2 parents 55796c9 + 2c7151d commit 2c12782

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/components/proposals/ProposalCard.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ export default function ProposalCard({
125125
}
126126

127127
if (isActive) {
128-
return percentage !== undefined ? `${percentage.toFixed(4)}%` : "0%";
128+
if (percentage !== undefined) {
129+
// Remove trailing zeros and unnecessary decimal point
130+
const formatted = percentage.toFixed(4).replace(/\.?0+$/, "");
131+
return `${formatted}%`;
132+
}
133+
return "0%";
129134
}
130135

131136
return met ? "Passed" : "Failed";

src/components/proposals/VotesTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const VotesTable = ({ proposalId, limit }: VotesTableProps) => {
7272
return (
7373
<Badge variant="secondary" className="text-xs">
7474
{typeof finalScore === "number"
75-
? finalScore.toFixed(4)
75+
? Math.round(finalScore)
7676
: String(finalScore)}
7777
</Badge>
7878
);
@@ -82,7 +82,7 @@ const VotesTable = ({ proposalId, limit }: VotesTableProps) => {
8282
return (
8383
<Badge variant="secondary" className="text-xs">
8484
{typeof parsedScore === "number"
85-
? parsedScore.toFixed(4)
85+
? Math.round(parsedScore)
8686
: String(parsedScore)}
8787
</Badge>
8888
);

0 commit comments

Comments
 (0)