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
20 changes: 19 additions & 1 deletion frontend/src/styles/popups.scss
Original file line number Diff line number Diff line change
Expand Up @@ -899,19 +899,37 @@ body.darkMode {
border-collapse: collapse;
color: var(--text-color);

tbody {
clip-path: inset(0);
}

td {
padding: 0.5rem 0.5rem;
}

.modesticky {
position: sticky;
top: calc(1rem - 2px);
z-index: 2;
}

thead {
color: var(--sub-color);
font-size: 0.75rem;
position: sticky;
top: -2rem;
background-color: var(--bg-color) !important;
z-index: 3;
}

tbody tr:nth-child(odd) td {
tbody tr.odd {
background: var(--sub-alt-color);
}

tbody tr.even {
background: var(--bg-color);
}

td.infoIcons span {
margin: 0 0.1rem;
}
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/ts/commandline/commandline-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as TestLogic from "../test/test-logic";
import { getLanguageDisplayString } from "../utils/strings";
import * as ModesNotice from "../elements/modes-notice";
import { isAuthenticated } from "../firebase";
import * as ManualRestart from "../test/manual-restart-tracker";
import { areUnsortedArraysEqual } from "../utils/arrays";
import Config from "../config";
import { get as getTypingSpeedUnit } from "../utils/typing-speed-units";
Expand Down Expand Up @@ -112,15 +111,13 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
subgroup: {
options: [10, 25, 50, 100],
afterExec: () => {
ManualRestart.set();
TestLogic.restart();
},
},
input: {
inputValueConvert: Number,

afterExec: () => {
ManualRestart.set();
TestLogic.restart();
},
},
Expand All @@ -129,14 +126,12 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
subgroup: {
options: [15, 30, 60, 120],
afterExec: () => {
ManualRestart.set();
TestLogic.restart();
},
},
input: {
inputValueConvert: Number,
afterExec: () => {
ManualRestart.set();
TestLogic.restart();
},
},
Expand All @@ -145,7 +140,6 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
subgroup: {
options: "fromSchema",
afterExec: () => {
ManualRestart.set();
TestLogic.restart();
},
},
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/ts/commandline/lists/funbox.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Funbox from "../../test/funbox/funbox";
import * as TestLogic from "../../test/test-logic";
import * as ManualRestart from "../../test/manual-restart-tracker";
import { getAllFunboxes, checkCompatibility } from "@monkeytype/funbox";
import { Command, CommandsSubgroup } from "../types";
import { getActiveFunboxNames } from "../../test/funbox/list";
Expand All @@ -13,7 +12,6 @@ const list: Command[] = [
alias: "off",
sticky: true,
exec: (): void => {
ManualRestart.set();
if (Funbox.setFunbox([])) {
TestLogic.restart();
}
Expand All @@ -36,7 +34,6 @@ for (const funbox of getAllFunboxes()) {
configValueMode: "include",
exec: (): void => {
Funbox.toggleFunbox(funbox.name);
ManualRestart.set();
TestLogic.restart();
},
});
Expand Down
13 changes: 10 additions & 3 deletions frontend/src/ts/components/pages/profile/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,14 @@ function PbTable<M extends "time" | "words">(props: {
<div class="grid grid-cols-2 gap-8 p-4 md:grid-cols-4">
<For each={bests()}>
{(item) => (
<div class="grid items-center">
<div class="col-start-1 row-start-1 text-center">
<div class="group grid items-center">
<div
class={
item.pb !== undefined
? "col-start-1 row-start-1 text-center transition-opacity group-hover:opacity-0"
: "col-start-1 row-start-1 text-center"
}
>
<div class="text-xs text-sub">
{item.mode2} {props.mode === "time" ? "seconds" : "words"}
</div>
Expand All @@ -142,8 +148,9 @@ function PbTable<M extends "time" | "words">(props: {
})}
</div>
</div>

<Show when={item.pb !== undefined}>
<div class="col-start-1 row-start-1 grid bg-sub-alt text-center text-xs opacity-0 transition-opacity hover:opacity-100">
<div class="col-start-1 row-start-1 grid bg-sub-alt text-center text-xs opacity-0 transition-opacity group-hover:opacity-100">
<div class="text-sub">
{item.mode2} {props.mode === "time" ? "seconds" : "words"}
</div>
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/ts/constants/fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,10 @@ export const Fonts: Record<KnownFontName, FontConfig> = {
Adwaita_Mono: {
fileName: "AdwaitaMono-Regular.woff2",
},
Inter_Tight: {
fileName: "InterTight-Regular.woff2",
},
Space_Grotesk: {
fileName: "SpaceGrotesk-Regular.woff2",
},
};
4 changes: 0 additions & 4 deletions frontend/src/ts/controllers/challenge-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
showErrorNotification,
showSuccessNotification,
} from "../stores/notifications";
import * as ManualRestart from "../test/manual-restart-tracker";
import * as CustomText from "../test/custom-text";
import * as Funbox from "../test/funbox/funbox";
import Config, { setConfig } from "../config";
Expand Down Expand Up @@ -215,7 +214,6 @@ export async function setup(challengeName: string): Promise<boolean> {
const { data: list, error } = await tryCatch(JSONData.getChallengeList());
if (error) {
showErrorNotification("Failed to setup challenge", { error });
ManualRestart.set();
setTimeout(() => {
qs("header .config")?.show();
qs(".page.pageTest")?.show();
Expand All @@ -230,7 +228,6 @@ export async function setup(challengeName: string): Promise<boolean> {
try {
if (challenge === undefined) {
showNoticeNotification("Challenge not found");
ManualRestart.set();
setTimeout(() => {
qs("header .config")?.show();
qs(".page.pageTest")?.show();
Expand Down Expand Up @@ -372,7 +369,6 @@ export async function setup(challengeName: string): Promise<boolean> {
});
}
}
ManualRestart.set();
notitext = challenge.message;
qs("header .config")?.show();
qs(".page.pageTest")?.show();
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/ts/controllers/url-handler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
showSuccessNotification,
} from "../stores/notifications";
import * as CustomText from "../test/custom-text";
import * as ManualRestart from "../test/manual-restart-tracker";
import { restart as restartTest } from "../test/test-logic";
import * as TestState from "../test/test-state";
import * as Misc from "../utils/misc";
Expand Down Expand Up @@ -205,7 +204,6 @@ export function loadTestSettingsFromUrl(getOverride?: string): void {
} else if (mode === "quote") {
setConfig("quoteLength", [-2]);
TestState.setSelectedQuoteId(parseInt(de[1], 10));
ManualRestart.set();
}
applied["mode2"] = de[1];
}
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/ts/event-handlers/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { focusWords } from "../test/test-ui";
import * as TestLogic from "../test/test-logic";
import { navigate } from "../controllers/route-controller";
import { isInputElementFocused } from "../input/input-element";
import * as ManualRestart from "../test/manual-restart-tracker";
import * as TestState from "../test/test-state";
import { isDevEnvironment } from "../utils/env";

Expand Down Expand Up @@ -76,10 +75,7 @@ document.addEventListener("keydown", (e) => {
) {
e.preventDefault();
if (getActivePage() === "test") {
if (e.shiftKey) {
ManualRestart.set();
}
TestLogic.restart();
TestLogic.restart({ isQuickRestart: !e.shiftKey });
} else {
void navigate("");
}
Expand Down
18 changes: 3 additions & 15 deletions frontend/src/ts/input/handlers/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
} from "../../stores/notifications";
import * as KeyConverter from "../../utils/key-converter";
import * as ShiftTracker from "../../test/shift-tracker";
import * as ManualRestart from "../../test/manual-restart-tracker";
import { canQuickRestart } from "../../utils/quick-restart";
import * as CustomText from "../../test/custom-text";
import * as CustomTextState from "../../states/custom-text-name";
Expand All @@ -32,10 +31,7 @@ export async function handleTab(e: KeyboardEvent, now: number): Promise<void> {
if (Config.quickRestart === "tab") {
e.preventDefault();
if ((TestWords.hasTab && e.shiftKey) || !TestWords.hasTab) {
if (e.shiftKey) {
ManualRestart.set();
}
TestLogic.restart();
TestLogic.restart({ isQuickRestart: !e.shiftKey });
return;
}
}
Expand Down Expand Up @@ -88,10 +84,7 @@ export async function handleEnter(
if (Config.quickRestart === "enter") {
e.preventDefault();
if ((TestWords.hasNewline && e.shiftKey) || !TestWords.hasNewline) {
if (e.shiftKey) {
ManualRestart.set();
}
TestLogic.restart();
TestLogic.restart({ isQuickRestart: !e.shiftKey });
return;
}
}
Expand Down Expand Up @@ -202,12 +195,7 @@ export async function onKeydown(event: KeyboardEvent): Promise<void> {

if (event.key === "Escape" && Config.quickRestart === "esc") {
event.preventDefault();

if (event.shiftKey) {
ManualRestart.set();
}

TestLogic.restart();
TestLogic.restart({ isQuickRestart: !event.shiftKey });
return;
}
}
2 changes: 0 additions & 2 deletions frontend/src/ts/modals/custom-test-duration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Config, { setConfig } from "../config";
import * as ManualRestart from "../test/manual-restart-tracker";
import * as TestLogic from "../test/test-logic";
import { showNoticeNotification } from "../stores/notifications";
import AnimatedModal, { ShowOptions } from "../utils/animated-modal";
Expand Down Expand Up @@ -94,7 +93,6 @@ function apply(): void {

if (val !== null && !isNaN(val) && val >= 0 && isFinite(val)) {
setConfig("time", val);
ManualRestart.set();
TestLogic.restart();
if (val >= 1800) {
showNoticeNotification("Stay safe and take breaks!");
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/ts/modals/custom-text.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as CustomText from "../test/custom-text";
import * as CustomTextState from "../states/custom-text-name";
import * as ManualRestart from "../test/manual-restart-tracker";
import * as TestLogic from "../test/test-logic";
import * as ChallengeController from "../controllers/challenge-controller";
import Config, { setConfig } from "../config";
Expand Down Expand Up @@ -397,7 +396,6 @@ function apply(): void {
}

ChallengeController.clearActive();
ManualRestart.set();
if (Config.mode !== "custom") {
setConfig("mode", "custom");
}
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/ts/modals/custom-word-amount.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Config, { setConfig } from "../config";
import * as ManualRestart from "../test/manual-restart-tracker";
import * as TestLogic from "../test/test-logic";
import { showNoticeNotification } from "../stores/notifications";
import AnimatedModal, { ShowOptions } from "../utils/animated-modal";
Expand Down Expand Up @@ -28,7 +27,6 @@ function apply(): void {

if (val !== null && !isNaN(val) && val >= 0 && isFinite(val)) {
if (setConfig("words", val)) {
ManualRestart.set();
TestLogic.restart();
if (val > 2000) {
showNoticeNotification("Stay safe and take breaks!");
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/ts/modals/mobile-test-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as TestLogic from "../test/test-logic";
import Config, { setConfig, setQuoteLengthAll } from "../config";
import * as ManualRestart from "../test/manual-restart-tracker";
import * as CustomWordAmountPopup from "./custom-word-amount";
import * as CustomTestDurationPopup from "./custom-test-duration";
import * as QuoteSearchModal from "./quote-search";
Expand Down Expand Up @@ -90,7 +89,6 @@ async function setup(modalEl: ElementWithUtils): Promise<void> {
} else if (wrd !== undefined) {
const wrdNum = parseInt(wrd);
setConfig("words", wrdNum);
ManualRestart.set();
TestLogic.restart();
}
});
Expand All @@ -100,7 +98,6 @@ async function setup(modalEl: ElementWithUtils): Promise<void> {
const mode = target.getAttribute("data-mode");
if (mode === Config.mode) return;
setConfig("mode", mode as Mode);
ManualRestart.set();
TestLogic.restart();
});

Expand All @@ -115,7 +112,6 @@ async function setup(modalEl: ElementWithUtils): Promise<void> {
} else if (time !== undefined) {
const timeNum = parseInt(time);
setConfig("time", timeNum);
ManualRestart.set();
TestLogic.restart();
}
});
Expand All @@ -126,7 +122,6 @@ async function setup(modalEl: ElementWithUtils): Promise<void> {

if (lenAttr === "all") {
if (setQuoteLengthAll()) {
ManualRestart.set();
TestLogic.restart();
}
} else if (lenAttr === "-2") {
Expand All @@ -144,7 +139,6 @@ async function setup(modalEl: ElementWithUtils): Promise<void> {
}

if (setConfig("quoteLength", arr)) {
ManualRestart.set();
TestLogic.restart();
}
}
Expand All @@ -158,13 +152,11 @@ async function setup(modalEl: ElementWithUtils): Promise<void> {

modalEl.qs(".punctuation")?.on("click", () => {
setConfig("punctuation", !Config.punctuation);
ManualRestart.set();
TestLogic.restart();
});

modalEl.qs(".numbers")?.on("click", () => {
setConfig("numbers", !Config.numbers);
ManualRestart.set();
TestLogic.restart();
});

Expand Down
Loading
Loading