mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-02-04 06:29:06 +08:00
fix(tape): stuck after restarting
This commit is contained in:
parent
fd8001ca75
commit
d6484109b6
2 changed files with 10 additions and 4 deletions
|
|
@ -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, {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue