fix(tape): stuck after restarting

This commit is contained in:
Miodec 2025-12-14 19:00:01 +01:00
parent fd8001ca75
commit d6484109b6
2 changed files with 10 additions and 4 deletions

View file

@ -273,14 +273,21 @@ export function restart(options = {} as RestartOptions): void {
ConnectionState.showOfflineBanner();
}
// TestUI.beforeTestRestart();
let source: "testPage" | "resultPage";
let el: HTMLElement;
if (TestState.resultVisible) {
//results are being displayed
el = document.querySelector("#result") as HTMLElement;
source = "resultPage";
} else {
//words are being displayed
el = document.querySelector("#typingTest") as HTMLElement;
source = "testPage";
}
TestState.setResultVisible(false);
TestState.setTestRestarting(true);
animate(el, {
@ -316,8 +323,7 @@ export function restart(options = {} as RestartOptions): void {
fb.functions.restart();
}
TestUI.onTestRestart();
TestState.setResultVisible(false);
TestUI.onTestRestart(source);
const typingTestEl = document.querySelector("#typingTest") as HTMLElement;
animate(typingTestEl, {

View file

@ -1844,7 +1844,7 @@ export function onTestStart(): void {
TimerProgress.update();
}
export function onTestRestart(): void {
export function onTestRestart(source: "testPage" | "resultPage"): void {
$("#result").addClass("hidden");
$("#typingTest").css("opacity", 0).removeClass("hidden");
getInputElement().style.left = "0";
@ -1875,7 +1875,7 @@ export function onTestRestart(): void {
void ModesNotice.update();
}
if (TestState.resultVisible) {
if (source === "resultPage") {
if (Config.randomTheme !== "off") {
void ThemeController.randomizeTheme();
}