Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions frontend/src/ts/controllers/route-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ export async function navigate(
important: true,
},
);
//todo: figure out if this was ever used
// event?.preventDefault();
return;
}

Expand Down
128 changes: 0 additions & 128 deletions frontend/src/ts/elements/result-batches.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be converted to solidjs

This file was deleted.

23 changes: 12 additions & 11 deletions frontend/src/ts/test/result.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//TODO: use Format
import { Chart, type PluginChartOptions } from "chart.js";

import { Config } from "../config/store";
Expand Down Expand Up @@ -290,9 +289,10 @@ export async function updateChartPBLine(): Promise<void> {
const localPbWpm = localPb?.wpm ?? 0;
if (localPbWpm === 0) return;
const typingSpeedUnit = getTypingSpeedUnit(Config.typingSpeedUnit);
const chartlpb = Numbers.roundTo2(
const chartlpb = Format.decimals(
typingSpeedUnit.fromWpm(localPbWpm),
).toFixed(2);
{ showDecimalPlaces: true },
);
resultAnnotation.push({
display: true,
type: "line",
Expand Down Expand Up @@ -345,18 +345,18 @@ function updateWpmAndAcc(): void {
if (Config.typingSpeedUnit !== "wpm") {
qs("#result .stats .wpm .bottom")?.setAttribute(
"aria-label",
`${result.wpm.toFixed(2)} wpm`,
`${Format.decimals(result.wpm, { showDecimalPlaces: true, suffix: " wpm" })}`,
);
qs("#result .stats .raw .bottom")?.setAttribute(
"aria-label",
`${result.rawWpm.toFixed(2)} wpm`,
`${Format.decimals(result.rawWpm, { showDecimalPlaces: true, suffix: " wpm" })}`,
);
} else {
qs("#result .stats .wpm .bottom")?.removeAttribute("aria-label");
qs("#result .stats .raw .bottom")?.removeAttribute("aria-label");
}

let time = `${Numbers.roundTo2(result.testDuration).toFixed(2)}s`;
let time = `${Format.decimals(result.testDuration, { showDecimalPlaces: true, suffix: "s" })}`;
if (result.testDuration > 61) {
time = DateTime.secondsToString(Numbers.roundTo2(result.testDuration));
}
Expand All @@ -377,8 +377,8 @@ function updateWpmAndAcc(): void {
let rawWpmHover = Format.typingSpeed(result.rawWpm, decimalsAndSuffix);

if (Config.typingSpeedUnit !== "wpm") {
wpmHover += ` (${result.wpm.toFixed(2)} wpm)`;
rawWpmHover += ` (${result.rawWpm.toFixed(2)} wpm)`;
wpmHover += ` (${Format.decimals(result.wpm, { showDecimalPlaces: true, suffix: " wpm" })})`;
rawWpmHover += ` (${Format.decimals(result.rawWpm, { showDecimalPlaces: true, suffix: " wpm" })})`;
}

qs("#result .stats .wpm .bottom")?.setAttribute("aria-label", wpmHover);
Expand Down Expand Up @@ -437,7 +437,7 @@ function updateTime(): void {
);

if (Config.alwaysShowDecimalPlaces) {
let time = `${Numbers.roundTo2(result.testDuration).toFixed(2)}s`;
let time = `${Format.decimals(result.testDuration, { showDecimalPlaces: true, suffix: "s" })}`;
if (result.testDuration > 61) {
time = DateTime.secondsToString(Numbers.roundTo2(result.testDuration));
}
Expand Down Expand Up @@ -743,9 +743,10 @@ async function updateTags(dontSave: boolean): Promise<void> {
position: annotationSide,
xAdjust: labelAdjust,
display: true,
content: `${tag.name} PB: ${Numbers.roundTo2(
content: `${tag.name} PB: ${Format.decimals(
typingSpeedUnit.fromWpm(tpb),
).toFixed(2)}`,
{ showDecimalPlaces: true },
)}`,
},
});
if (annotationSide === "start") {
Expand Down
Loading