add preloaders
This commit is contained in:
parent
7527131951
commit
8b47951e2a
2 changed files with 13 additions and 12 deletions
|
|
@ -32,17 +32,17 @@ function StatsPanel(props: { visibilityInfo?: VisibilityInfo | null, noStats?: b
|
|||
|
||||
const transactions = info ? info.height + info.tx_count : 0;
|
||||
|
||||
const infoHeight = Utils.formatNumber(info?.height || 0, 0);
|
||||
const posDiff = Utils.toShiftedNumber(info?.pos_difficulty || "0", 0, 0);
|
||||
const powDiff = Utils.formatNumber(info?.pow_difficulty || 0, 0);
|
||||
const coinsEmitted = Utils.toShiftedNumber(info?.total_coins || "0", 12);
|
||||
const transactionsString = Utils.formatNumber(transactions, 0);
|
||||
const hashrate = Utils.toShiftedNumber(info?.current_network_hashrate_350 || 0, NET_MODE === "TEST" ? 0 : 9, 3);
|
||||
const infoHeight = Utils.formatNumber(info?.height, 0) || "...";
|
||||
const posDiff = Utils.toShiftedNumber(info?.pos_difficulty, 0, 0) || "...";
|
||||
const powDiff = Utils.formatNumber(info?.pow_difficulty, 0) || "...";
|
||||
const coinsEmitted = Utils.toShiftedNumber(info?.total_coins, 12) || "...";
|
||||
const transactionsString = Utils.formatNumber(transactions, 0) || "...";
|
||||
const hashrate = Utils.toShiftedNumber(info?.current_network_hashrate_350, NET_MODE === "TEST" ? 0 : 9, 3) || "...";
|
||||
|
||||
const stackedCoins = Utils.toShiftedNumber(visibilityInfo?.amount.toString() || "0", 12);
|
||||
const percentage = visibilityInfo?.percentage || "0";
|
||||
const APY = parseFloat((visibilityInfo?.apy || 0).toFixed(4));
|
||||
const devFund = Utils.toShiftedNumber(visibilityInfo?.balance.toString() || "0", 12);
|
||||
const stackedCoins = Utils.toShiftedNumber(visibilityInfo?.amount.toString(), 12) || "...";
|
||||
const percentage = visibilityInfo?.percentage || "...";
|
||||
const APY = visibilityInfo?.apy ? parseFloat((visibilityInfo?.apy || 0).toFixed(4)) : "...";
|
||||
const devFund = Utils.toShiftedNumber(visibilityInfo?.balance.toString(), 12) || "...";
|
||||
|
||||
function TopItem(props: { title: string, amount: string, percent?: string, customCurrency?: boolean }) {
|
||||
const { title, amount, percent, customCurrency } = props;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ class Utils {
|
|||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
|
||||
static formatNumber(number: number | string, decimalPlaces: number = 2): string {
|
||||
static formatNumber(number: number | string | undefined, decimalPlaces: number = 2): string {
|
||||
if (number === undefined) return "";
|
||||
const parsedNumber = typeof number === "number" ? number : parseFloat(number) || 0;
|
||||
const roundedNumber = parsedNumber.toFixed(decimalPlaces);
|
||||
const [integerPart, decimalPart] = roundedNumber.split(".");
|
||||
|
|
@ -28,7 +29,7 @@ class Utils {
|
|||
return formattedNumber;
|
||||
}
|
||||
|
||||
static toShiftedNumber(number: number | string, shift: number = 2, decimalPlaces: number = 2) {
|
||||
static toShiftedNumber(number: number | string | undefined, shift: number = 2, decimalPlaces: number = 2) {
|
||||
if (typeof number !== "string" && typeof number !== "number") return "";
|
||||
const string = typeof number === "string" ? number : number.toString();
|
||||
const input = string.replace(/\D/g, "");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue