Skip to content

Commit

Permalink
sync: display sync percentage (#1763)
Browse files Browse the repository at this point in the history
* lose precision

* changeset
  • Loading branch information
TalDerei authored Sep 4, 2024
1 parent 3a5c074 commit 74527df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-tigers-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'minifront': minor
---

modify precision for sync percentage
7 changes: 5 additions & 2 deletions apps/minifront/src/state/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,17 @@ export const statusSelector = (
}
}

// Round down to ensure whole numbers
const roundedPercentSyncedNumber = Math.floor(percentSyncedNumber * 100);

return {
error: zQueryState.error,
isCatchingUp,
isUpdating,
fullSyncHeight,
latestKnownBlockHeight,
percentSyncedNumber,
percentSynced: `${percentSyncedNumber * 100}%`,
percentSyncedNumber: roundedPercentSyncedNumber / 100,
percentSynced: `${roundedPercentSyncedNumber}%`,
};
}
};

0 comments on commit 74527df

Please sign in to comment.