Skip to content

Commit

Permalink
beautify numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone committed Nov 12, 2024
1 parent feb837f commit 17f7b0f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/dashboard/Activity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { getEventEmitter } from '../event_bus';
import iCheck from '../../assets/icons/icon-check.svg';
import iHourglass from '../../assets/icons/icon-hourglass.svg';
import { blockCount } from '../global.js';
import { beautifyNumber } from '../misc.js';
const props = defineProps({
title: String,
Expand Down Expand Up @@ -265,11 +266,14 @@ async function parseTXs(arrTXs) {
// Format the amount to reduce text size
let formattedAmt = '';
if (amountToShow < 0.01) {
formattedAmt = '<0.01';
formattedAmt = beautifyNumber('0.01', '13px');
} else if (amountToShow >= 100) {
formattedAmt = Math.round(amountToShow).toString();
formattedAmt = beautifyNumber(
Math.round(amountToShow).toString(),
'13px'
);
} else {
formattedAmt = amountToShow.toFixed(2);
formattedAmt = beautifyNumber(`${amountToShow.toFixed(2)}`, '13px');
}
newTxs.push({
Expand Down

0 comments on commit 17f7b0f

Please sign in to comment.