Skip to content

Commit

Permalink
impr(modes notice): not showing decimal places
Browse files Browse the repository at this point in the history
  • Loading branch information
Miodec committed Feb 26, 2024
1 parent 69dff92 commit 39ad6f6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions frontend/src/ts/elements/modes-notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export async function update(): Promise<void> {
(Config.repeatedPace && TestState.isPaceRepeat)
) {
const speed = Format.typingSpeed(PaceCaret.settings?.wpm ?? 0, {
showDecimalPlaces: true,
showDecimalPlaces: false,
suffix: ` ${Config.typingSpeedUnit}`,
});

Expand All @@ -149,11 +149,14 @@ export async function update(): Promise<void> {

if (isAuthenticated() && avgWPM > 0) {
const avgWPMText = ["speed", "both"].includes(Config.showAverage)
? Format.typingSpeed(avgWPM, { suffix: ` ${Config.typingSpeedUnit}` })
? Format.typingSpeed(avgWPM, {
suffix: ` ${Config.typingSpeedUnit}`,
showDecimalPlaces: false,
})
: "";

const avgAccText = ["acc", "both"].includes(Config.showAverage)
? Format.accuracy(avgAcc, { suffix: " acc" })
? Format.accuracy(avgAcc, { suffix: " acc", showDecimalPlaces: false })
: "";

const text = `${avgWPMText} ${avgAccText}`.trim();
Expand All @@ -168,7 +171,7 @@ export async function update(): Promise<void> {
$(".pageTest #testModesNotice").append(
`<div class="textButton" commands="minWpm"><i class="fas fa-bomb"></i>min ${Format.typingSpeed(
Config.minWpmCustomSpeed,
{ showDecimalPlaces: true, suffix: ` ${Config.typingSpeedUnit}` }
{ showDecimalPlaces: false, suffix: ` ${Config.typingSpeedUnit}` }
)}</div>`
);
}
Expand All @@ -183,7 +186,7 @@ export async function update(): Promise<void> {
$(".pageTest #testModesNotice").append(
`<div class="textButton" commands="minBurst"><i class="fas fa-bomb"></i>min ${Format.typingSpeed(
Config.minBurstCustomSpeed,
{ showDecimalPlaces: true }
{ showDecimalPlaces: false }
)} ${Config.typingSpeedUnit} burst ${
Config.minBurst === "flex" ? "(flex)" : ""
}</div>`
Expand Down

0 comments on commit 39ad6f6

Please sign in to comment.