Skip to content
Merged
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
30 changes: 15 additions & 15 deletions frontend/src/ts/commandline/commandline-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
subgroup: {
options: "fromSchema",
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
},
numbers: {
subgroup: {
options: "fromSchema",
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
},
Expand All @@ -116,36 +116,36 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
subgroup: {
options: [10, 25, 50, 100],
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
input: {
inputValueConvert: Number,

afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
},
time: {
subgroup: {
options: [15, 30, 60, 120],
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
input: {
inputValueConvert: Number,
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
},
mode: {
subgroup: {
options: "fromSchema",
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
},
Expand Down Expand Up @@ -176,7 +176,7 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
return map[value[0] as number] as string;
},
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
},
Expand Down Expand Up @@ -262,7 +262,7 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
subgroup: {
options: "fromSchema",
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
},
Expand All @@ -285,7 +285,7 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
val.trim().split(" ") as ConfigSchemas.CustomPolyglot,
afterExec: () => {
if (getActivePage() === "test") {
TestLogic.restart();
void TestLogic.restart();
}
},
},
Expand Down Expand Up @@ -339,15 +339,15 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
lazyMode: {
subgroup: {
options: "fromSchema",
afterExec: () => TestLogic.restart(),
afterExec: () => void TestLogic.restart(),
},
},
layout: {
subgroup: {
options: "fromSchema",
display: (layout) =>
layout === "default" ? "off" : layout.replace(/_/g, " "),
afterExec: () => TestLogic.restart(),
afterExec: () => void TestLogic.restart(),
},
},
codeUnindentOnBackspace: {
Expand Down Expand Up @@ -484,7 +484,7 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
subgroup: {
options: ["off", "pb", "tagPb", "last", "average", "daily"],
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
input: {
Expand All @@ -496,7 +496,7 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
return newVal;
},
afterExec: () => {
TestLogic.restart();
void TestLogic.restart();
},
},
},
Expand Down Expand Up @@ -666,7 +666,7 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
alias: (val) => (val === "overrideSync" ? "default" : ""),
display: (layout) =>
layout === "overrideSync" ? "emulator sync" : layout.replace(/_/g, " "),
afterExec: () => TestLogic.restart(),
afterExec: () => void TestLogic.restart(),
},
},
keymapKeys: {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/ts/commandline/lists/funbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const list: Command[] = [
sticky: true,
exec: (): void => {
if (Funbox.setFunbox([])) {
TestLogic.restart();
void TestLogic.restart();
}
},
},
Expand All @@ -34,7 +34,7 @@ for (const funbox of getAllFunboxes()) {
configValueMode: "include",
exec: (): void => {
Funbox.toggleFunbox(funbox.name);
TestLogic.restart();
void TestLogic.restart();
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/commandline/lists/load-challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const subgroup: CommandsSubgroup = {
exec: async (): Promise<void> => {
await navigate("/");
await ChallengeController.setup(challenge.name);
TestLogic.restart({
void TestLogic.restart({
nosave: true,
});
},
Expand Down
25 changes: 13 additions & 12 deletions frontend/src/ts/commandline/lists/result-screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as PractiseWords from "../../test/practise-words";
import { Command, CommandsSubgroup } from "../types";
import * as TestScreenshot from "../../test/test-screenshot";
import { getInputHistory } from "../../test/events/stats";
import { getResultVisible } from "../../states/test";

const practiceSubgroup: CommandsSubgroup = {
title: "Practice words...",
Expand All @@ -21,7 +22,7 @@ const practiceSubgroup: CommandsSubgroup = {
display: "missed",
exec: (): void => {
PractiseWords.init("words", false);
TestLogic.restart({
void TestLogic.restart({
practiseMissed: true,
});
},
Expand All @@ -31,7 +32,7 @@ const practiceSubgroup: CommandsSubgroup = {
display: "slow",
exec: (): void => {
PractiseWords.init("off", true);
TestLogic.restart({
void TestLogic.restart({
practiseMissed: true,
});
},
Expand All @@ -41,7 +42,7 @@ const practiceSubgroup: CommandsSubgroup = {
display: "both",
exec: (): void => {
PractiseWords.init("words", true);
TestLogic.restart({
void TestLogic.restart({
practiseMissed: true,
});
},
Expand All @@ -67,23 +68,23 @@ const commands: Command[] = [
alias: "restart start begin type test typing",
icon: "fa-chevron-right",
available: (): boolean => {
return TestState.resultVisible;
return getResultVisible();
},
exec: (): void => {
TestLogic.restart();
void TestLogic.restart();
},
},
{
id: "repeatTest",
display: "Repeat test",
icon: "fa-sync-alt",
exec: (): void => {
TestLogic.restart({
void TestLogic.restart({
withSameWordset: true,
});
},
available: (): boolean => {
return TestState.resultVisible;
return getResultVisible();
},
},
{
Expand All @@ -92,7 +93,7 @@ const commands: Command[] = [
icon: "fa-exclamation-triangle",
subgroup: practiceSubgroup,
available: (): boolean => {
return TestState.resultVisible;
return getResultVisible();
},
},
{
Expand All @@ -103,7 +104,7 @@ const commands: Command[] = [
void TestUI.toggleResultWords();
},
available: (): boolean => {
return TestState.resultVisible;
return getResultVisible();
},
},
{
Expand All @@ -117,7 +118,7 @@ const commands: Command[] = [
}, 500);
},
available: (): boolean => {
return TestState.resultVisible;
return getResultVisible();
},
},
{
Expand All @@ -131,7 +132,7 @@ const commands: Command[] = [
}, 500);
},
available: (): boolean => {
return TestState.resultVisible;
return getResultVisible();
},
},
{
Expand Down Expand Up @@ -164,7 +165,7 @@ const commands: Command[] = [
);
},
available: (): boolean => {
return TestState.resultVisible;
return getResultVisible();
},
},
];
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/components/modals/QuoteSearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export function QuoteSearchModal(): JSXElement {
}
TestState.setSelectedQuoteId(quoteId);
setConfig("quoteLength", [-2]);
TestLogic.restart();
void TestLogic.restart();
hideModalAndClearChain("QuoteSearch");
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/controllers/preset-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function apply(_id: string): Promise<void> {
saveActiveToLocalStorage();
}
}
TestLogic.restart();
void TestLogic.restart();
showSuccessNotification("Preset applied", { durationMs: 2000 });
saveFullConfigToLocalStorage();
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/ts/controllers/pw-ad-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { Config } from "../config/store";
import { getActivePage } from "../states/core";
import * as TestState from "../test/test-state";
import { getResultVisible } from "../states/test";

// Step 1: Create the Ramp Object, NOTE: selector id needed for tagged units only
const resultUnits = [
Expand Down Expand Up @@ -207,7 +207,7 @@ function getUnits(): unknown {

export async function reinstate(): boolean {
if (!rampReady) return;
if (getActivePage() === "test" && !TestState.resultVisible) {
if (getActivePage() === "test" && !getResultVisible()) {
ramp.destroyUnits("all");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/ts/controllers/url-handler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export function loadTestSettingsFromUrl(getOverride?: string): void {
applied["funbox"] = val.join(", ");
}

restartTest({
void restartTest({
nosave: true,
});

Expand Down Expand Up @@ -331,7 +331,7 @@ export async function loadChallengeFromUrl(
ChallengeController.setup(challengeName)
.then((result) => {
if (result) {
restartTest({
void restartTest({
nosave: true,
});
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/ts/event-handlers/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getActivePage } from "../states/core";
import { ModifierKeys } from "../constants/modifier-keys";
import { focusWords } from "../test/test-ui";
import { isInputElementFocused } from "../input/input-element";
import * as TestState from "../test/test-state";
import { getResultVisible } from "../states/test";
import { isDevEnvironment } from "../utils/env";

document.addEventListener("keydown", (e) => {
Expand All @@ -24,7 +24,7 @@ document.addEventListener("keydown", (e) => {
}

const pageTestActive: boolean = getActivePage() === "test";
if (pageTestActive && !TestState.resultVisible && !isInputElementFocused()) {
if (pageTestActive && !getResultVisible() && !isInputElementFocused()) {
const popupVisible: boolean = Misc.isAnyPopupVisible();
// this is nested because isAnyPopupVisible is a bit expensive
// and we don't want to call it during the test
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/modals/practise-words.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function hide(clearChain = false): void {
function apply(): void {
PractiseWords.init(state.missed, state.slow);
hide(true);
TestLogic.restart({
void TestLogic.restart({
practiseMissed: true,
});
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/ts/pages/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const page = new Page({
blurInputElement();
},
afterHide: async (): Promise<void> => {
TestLogic.restart({
void TestLogic.restart({
noAnim: true,
});
void Funbox.clear();
Expand All @@ -23,7 +23,7 @@ export const page = new Page({
beforeShow: async (): Promise<void> => {
updateFooterAndVerticalAds(false);
resetIncompleteTests();
TestLogic.restart({
void TestLogic.restart({
noAnim: true,
});
},
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/ts/test/pace-caret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import {
getActiveWordIndex,
getCurrentQuote,
getResultVisible,
isPaceRepeat,
isTestActive,
setPaceCaretWpm,
Expand Down Expand Up @@ -122,7 +123,7 @@ export async function init(): Promise<void> {

export async function update(expectedStepEnd: number): Promise<void> {
const currentSettings = settings;
if (currentSettings === null || !isTestActive() || TestState.resultVisible) {
if (currentSettings === null || !isTestActive() || getResultVisible()) {
return;
}

Expand Down
Loading
Loading