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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ frontend/static/webfonts-preview
.turbo
frontend/.env.sentry-build-plugin
.claude/worktrees
1024MiB
1024MiB
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"mjml": "4.15.0",
"mongodb": "6.3.0",
"mustache": "4.2.0",
"nodemailer": "8.0.4",
"nodemailer": "8.0.5",
"object-hash": "3.0.0",
"prom-client": "15.1.3",
"rate-limiter-flexible": "5.0.3",
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/ts/components/modals/MobileTestConfigModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export function MobileTestConfigModal(): JSXElement {
if (value === "all") {
return areUnsortedArraysEqual(getConfig.quoteLength, [0, 1, 2, 3]);
}
if (value === "-2") return false;
if (value === "-2") {
return areUnsortedArraysEqual(getConfig.quoteLength, [-2]);
}
if (value === "-3") {
return areUnsortedArraysEqual(getConfig.quoteLength, [-3]);
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/ts/components/pages/test/TestConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ function Mode2Quote(props: ComponentProps<"div">): JSXElement {
fa={{
icon: "fa-search",
}}
active={areUnsortedArraysEqual(getConfig.quoteLength, [-2])}
onClick={() => {
showModal("QuoteSearch");
}}
Expand Down
16 changes: 9 additions & 7 deletions frontend/src/ts/states/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function addNotificationWithLevel(
message: string,
level: NotificationLevel,
options: AddNotificationOptions = {},
): void {
): number {
let details = options.details;

if (options.response !== undefined) {
Expand Down Expand Up @@ -174,25 +174,27 @@ export function addNotificationWithLevel(
}, durationMs + 250);
autoRemoveTimers.set(notifId, timer);
}

return notifId;
}

export function showNoticeNotification(
message: string,
options?: AddNotificationOptions,
): void {
addNotificationWithLevel(message, "notice", options);
): number {
return addNotificationWithLevel(message, "notice", options);
}

export function showSuccessNotification(
message: string,
options?: AddNotificationOptions,
): void {
addNotificationWithLevel(message, "success", options);
): number {
return addNotificationWithLevel(message, "success", options);
}

export function showErrorNotification(
message: string,
options?: AddNotificationOptions,
): void {
addNotificationWithLevel(message, "error", options);
): number {
return addNotificationWithLevel(message, "error", options);
}
4 changes: 3 additions & 1 deletion frontend/src/ts/test/test-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export let isRepeated = false;
export let isPaceRepeat = false;
export let isActive = false;
export let bailedOut = false;
export let selectedQuoteId = 1;
export let selectedQuoteId =
parseInt(localStorage.getItem("selectedQuoteId") ?? "1", 10) || 1;
export let activeWordIndex = 0;
export let testInitSuccess = true;
export let isLanguageRightToLeft = false;
Expand All @@ -30,6 +31,7 @@ export function setBailedOut(tf: boolean): void {

export function setSelectedQuoteId(id: number): void {
selectedQuoteId = id;
localStorage.setItem("selectedQuoteId", id.toString());
}

export function setActiveWordIndex(index: number): void {
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/ts/test/test-timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import * as Numbers from "@monkeytype/util/numbers";
import {
showNoticeNotification,
showErrorNotification,
removeNotification,
} from "../states/notifications";
import * as Caret from "./caret";
import * as SlowTimer from "../legacy-states/slow-timer";
Expand Down Expand Up @@ -52,6 +53,7 @@ type TimerStats = {
};

let slowTimerCount = 0;
let slowTimerNotifIds: number[] = [];
let timer: NodeJS.Timeout | null = null;
const interval = 1000;
let expected = 0;
Expand Down Expand Up @@ -284,8 +286,10 @@ function checkIfTimerIsSlow(drift: number): void {
'This could be caused by "efficiency mode" on Microsoft Edge.',
);

showErrorNotification(
"Stopping the test due to bad performance. This would cause test calculations to be incorrect. If this happens a lot, please report this.",
slowTimerNotifIds.push(
showErrorNotification(
"Stopping the test due to bad performance. This would cause test calculations to be incorrect. If this happens a lot, please report this.",
),
);

timerEvent.dispatch({ key: "fail", value: "slow timer" });
Expand All @@ -296,6 +300,10 @@ function checkIfTimerIsSlow(drift: number): void {
export async function start(): Promise<void> {
SlowTimer.clear();
slowTimerCount = 0;
for (const id of slowTimerNotifIds) {
removeNotification(id, "clear");
}
slowTimerNotifIds = [];
void _startNew();
// void _startOld();
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/utils/json-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function memoizeAsync<P, Args extends unknown[], R>(
const key = getKey ? getKey(...args) : (args[0] as P);

const cached = cache.get(key);
if (cached) {
if (cached !== undefined) {
return cached;
}

Expand Down
4 changes: 1 addition & 3 deletions frontend/static/languages/french_10k.json
Original file line number Diff line number Diff line change
Expand Up @@ -2312,7 +2312,7 @@
"réduit",
"ambigu",
"wagon",
"déballe!",
"déballe",
"obèse",
"adultes",
"vagabond",
Expand Down Expand Up @@ -3957,7 +3957,6 @@
"discrédit",
"corrections",
"travaillait",
"assez!",
"transporte",
"positif",
"dixième",
Expand Down Expand Up @@ -5476,7 +5475,6 @@
"absolutisme",
"frénésie",
"dorage",
"feu!",
"verrou",
"outrage",
"cash",
Expand Down
13 changes: 12 additions & 1 deletion frontend/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ const plugins = [
solidPlugin({ hot: false }),
];

const tanstackSolidNoExternal: (string | RegExp)[] = [
"@solidjs/meta",
/@tanstack\/solid-.*/,
];

export const projects: UserWorkspaceConfig[] = [
{
ssr: {
noExternal: tanstackSolidNoExternal,
},
test: {
name: { label: "unit", color: "blue" },
include: ["__tests__/**/*.spec.ts"],
Expand All @@ -26,6 +34,9 @@ export const projects: UserWorkspaceConfig[] = [
plugins,
},
{
ssr: {
noExternal: tanstackSolidNoExternal,
},
test: {
name: { label: "jsdom", color: "yellow" },
include: ["__tests__/**/*.jsdom-spec.ts"],
Expand All @@ -36,7 +47,7 @@ export const projects: UserWorkspaceConfig[] = [
},
{
ssr: {
noExternal: ["@solidjs/meta"],
noExternal: tanstackSolidNoExternal,
},
test: {
name: { label: "jsx", color: "green" },
Expand Down
Loading
Loading