mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-06 15:34:06 +08:00
impr(about): add spaces to the stats numbers to make them easier to read
This commit is contained in:
parent
1b71d05a9f
commit
eb89b838a5
2 changed files with 7 additions and 3 deletions
|
|
@ -53,7 +53,7 @@ function updateStatsAndHistogram(): void {
|
|||
$(".pageAbout #totalTimeTypingStat .valSmall").text("years");
|
||||
$(".pageAbout #totalTimeTypingStat").attr(
|
||||
"aria-label",
|
||||
Math.round(secondsRounded / 3600) + " hours"
|
||||
Misc.numberWithSpaces(Math.round(secondsRounded / 3600)) + " hours"
|
||||
);
|
||||
|
||||
const startedWithMagnitude = Misc.getNumberWithMagnitude(
|
||||
|
|
@ -70,7 +70,7 @@ function updateStatsAndHistogram(): void {
|
|||
);
|
||||
$(".pageAbout #totalStartedTestsStat").attr(
|
||||
"aria-label",
|
||||
typingStatsResponseData.testsStarted + " tests"
|
||||
Misc.numberWithSpaces(typingStatsResponseData.testsStarted) + " tests"
|
||||
);
|
||||
|
||||
const completedWIthMagnitude = Misc.getNumberWithMagnitude(
|
||||
|
|
@ -87,7 +87,7 @@ function updateStatsAndHistogram(): void {
|
|||
);
|
||||
$(".pageAbout #totalCompletedTestsStat").attr(
|
||||
"aria-label",
|
||||
typingStatsResponseData.testsCompleted + " tests"
|
||||
Misc.numberWithSpaces(typingStatsResponseData.testsCompleted) + " tests"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1707,4 +1707,8 @@ export function getNumberWithMagnitude(num: number): {
|
|||
};
|
||||
}
|
||||
|
||||
export function numberWithSpaces(x: number): string {
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
||||
}
|
||||
|
||||
// DO NOT ALTER GLOBAL OBJECTSONSTRUCTOR, IT WILL BREAK RESULT HASHES
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue