Skip to content

Commit

Permalink
floor to three decimals and update n.a. ui
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-babylonlabs committed Sep 18, 2024
1 parent abb31f0 commit 422ccfe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/components/Points/DelegationPoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const DelegationPoints: React.FC<DelegationPointsProps> = ({
<div className="flex items-center justify-end gap-1">
<p className="whitespace-nowrap">
<span className="lg:hidden">Points: </span>
{points !== undefined ? points : 0}
{points !== undefined ? points : "n.a."}
</p>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Points/StakerPoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const StakerPoints: React.FC<StakerPointsProps> = ({
return (
<div className="flex items-center justify-end gap-1">
<p className="whitespace-nowrap font-semibold">
{points !== undefined ? points : 0}
{points !== undefined ? points : "n.a."}
</p>
</div>
);
Expand Down
6 changes: 2 additions & 4 deletions src/app/context/api/DelegationsPointsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ export const DelegationsPointsProvider: React.FC<
const newDelegationPoints = new Map<string, number>();
data.forEach((point) => {
if (point) {
newDelegationPoints.set(
point.staking_tx_hash_hex,
point.staker.points,
);
const flooredPoints = Math.floor(point.staker.points * 1000) / 1000; // Floors the points to 3 decimal places
newDelegationPoints.set(point.staking_tx_hash_hex, flooredPoints);
}
});
setDelegationPoints(newDelegationPoints);
Expand Down

0 comments on commit 422ccfe

Please sign in to comment.