From 1bd5abdf62157041eb51a8e4ee74370ff26a683f Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 20:12:56 +0300 Subject: [PATCH 01/24] fix(quote-search): length description is incorrect for some languages --- frontend/src/ts/components/modals/QuoteRateModal.tsx | 11 +---------- .../src/ts/components/modals/QuoteSearchModal.tsx | 8 +------- frontend/src/ts/states/quote-rate.ts | 10 ++++++++++ 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/frontend/src/ts/components/modals/QuoteRateModal.tsx b/frontend/src/ts/components/modals/QuoteRateModal.tsx index 4a04aa051cfb..3618c4cc6088 100644 --- a/frontend/src/ts/components/modals/QuoteRateModal.tsx +++ b/frontend/src/ts/components/modals/QuoteRateModal.tsx @@ -16,6 +16,7 @@ import { getQuoteStats, updateQuoteStats, getRatingAverage, + getLengthDesc, } from "../../states/quote-rate"; import { cn } from "../../utils/cn"; import { qs } from "../../utils/dom"; @@ -28,16 +29,6 @@ export function QuoteRateModal(): JSXElement { const [rating, setRating] = createSignal(0); const [hoverRating, setHoverRating] = createSignal(0); - const getLengthDesc = (): string => { - const quote = selectedQuote(); - if (!quote) return "-"; - if (quote.group === 0) return "short"; - if (quote.group === 1) return "medium"; - if (quote.group === 2) return "long"; - if (quote.group === 3) return "thicc"; - return "-"; - }; - const displayRating = (): number => hoverRating() || rating(); const handleBeforeShow = (): void => { diff --git a/frontend/src/ts/components/modals/QuoteSearchModal.tsx b/frontend/src/ts/components/modals/QuoteSearchModal.tsx index 35e26fbd9dfb..af9b96003a63 100644 --- a/frontend/src/ts/components/modals/QuoteSearchModal.tsx +++ b/frontend/src/ts/components/modals/QuoteSearchModal.tsx @@ -27,6 +27,7 @@ import { showNoticeNotification, showErrorNotification, } from "../../states/notifications"; +import { getLengthDesc } from "../../states/quote-rate"; import { showQuoteReportModal } from "../../states/quote-report"; import { showSimpleModal } from "../../states/simple-modal"; import * as TestLogic from "../../test/test-logic"; @@ -92,13 +93,6 @@ function exactSearch(quotes: Quote[], captured: RegExp[]): [Quote[], string[]] { return [matches, Array.from(exactSearchQueryTerms)]; } -function getLengthDesc(quote: Quote): string { - if (quote.length < 101) return "short"; - if (quote.length < 301) return "medium"; - if (quote.length < 601) return "long"; - return "thicc"; -} - function Item(props: { quote: Quote; matchedTerms: string[]; diff --git a/frontend/src/ts/states/quote-rate.ts b/frontend/src/ts/states/quote-rate.ts index ce030c74dbeb..5cc17c10eb1e 100644 --- a/frontend/src/ts/states/quote-rate.ts +++ b/frontend/src/ts/states/quote-rate.ts @@ -74,3 +74,13 @@ export function showQuoteRateModal(quote: Quote): void { setSelectedQuote(quote); showModal("QuoteRate"); } + +export function getLengthDesc(quoteToCheck?: Quote): string { + const quote = quoteToCheck ?? selectedQuote(); + if (!quote) return "-"; + if (quote.group === 0) return "short"; + if (quote.group === 1) return "medium"; + if (quote.group === 2) return "long"; + if (quote.group === 3) return "thicc"; + return "-"; +} From 7fd13ba2292d442d33c6f8f41349ad869e84ac25 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 20:18:23 +0300 Subject: [PATCH 02/24] Stricter return type --- frontend/src/ts/states/quote-rate.ts | 3 ++- packages/schemas/src/quotes.ts | 9 +++++++++ packages/schemas/src/shared.ts | 7 ------- packages/schemas/src/users.ts | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/frontend/src/ts/states/quote-rate.ts b/frontend/src/ts/states/quote-rate.ts index 5cc17c10eb1e..48f86bbc0a4b 100644 --- a/frontend/src/ts/states/quote-rate.ts +++ b/frontend/src/ts/states/quote-rate.ts @@ -5,6 +5,7 @@ import { Quote } from "../controllers/quotes-controller"; import { showErrorNotification } from "./notifications"; import { showModal } from "./modals"; import { isSafeNumber } from "@monkeytype/util/numbers"; +import { QuoteLength } from "@monkeytype/schemas/quotes"; type QuoteStats = { average?: number; @@ -75,7 +76,7 @@ export function showQuoteRateModal(quote: Quote): void { showModal("QuoteRate"); } -export function getLengthDesc(quoteToCheck?: Quote): string { +export function getLengthDesc(quoteToCheck?: Quote): QuoteLength | "-" { const quote = quoteToCheck ?? selectedQuote(); if (!quote) return "-"; if (quote.group === 0) return "short"; diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index 2925e56a5019..b5f1d2a2323b 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -9,6 +9,15 @@ export const QuoteIdSchema = z .or(z.string().regex(/^\d+$/).transform(Number)); export type QuoteId = z.infer; +export const QuoteLengthSchema = z.union([ + z.literal("short"), + z.literal("medium"), + z.literal("long"), + z.literal("thicc"), +]); + +export type QuoteLength = z.infer; + export const ApproveQuoteSchema = z.object({ id: QuoteIdSchema, text: z.string(), diff --git a/packages/schemas/src/shared.ts b/packages/schemas/src/shared.ts index 7a1f5b570d07..b4ed155a37fb 100644 --- a/packages/schemas/src/shared.ts +++ b/packages/schemas/src/shared.ts @@ -51,13 +51,6 @@ export const DefaultTimeModeSchema = z.union([ z.literal("120"), ]); -export const QuoteLengthSchema = z.union([ - z.literal("short"), - z.literal("medium"), - z.literal("long"), - z.literal("thicc"), -]); - // // Step 1: Define the schema for specific string values "10" and "25" // const SpecificKeySchema = z.union([z.literal("10"), z.literal("25")]); diff --git a/packages/schemas/src/users.ts b/packages/schemas/src/users.ts index e81e577fa9db..5f2421e8589c 100644 --- a/packages/schemas/src/users.ts +++ b/packages/schemas/src/users.ts @@ -7,10 +7,10 @@ import { PersonalBestsSchema, DefaultWordsModeSchema, DefaultTimeModeSchema, - QuoteLengthSchema, DifficultySchema, PersonalBestSchema, } from "./shared"; +import { QuoteLengthSchema } from "./quotes"; import { CustomThemeColorsSchema, FunboxNameSchema } from "./configs"; import { doesNotContainDisallowedWords } from "./validation/validation"; import { ConnectionSchema } from "./connections"; From 502fb0fdc99607ffd8bd11171d01587b3ff4a5d2 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 20:42:16 +0300 Subject: [PATCH 03/24] Simplify --- frontend/src/ts/components/modals/QuoteRateModal.tsx | 2 +- frontend/src/ts/states/quote-rate.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/ts/components/modals/QuoteRateModal.tsx b/frontend/src/ts/components/modals/QuoteRateModal.tsx index 3618c4cc6088..29e92dce09d0 100644 --- a/frontend/src/ts/components/modals/QuoteRateModal.tsx +++ b/frontend/src/ts/components/modals/QuoteRateModal.tsx @@ -143,7 +143,7 @@ export function QuoteRateModal(): JSXElement {
length
- {getLengthDesc()} + {getLengthDesc(selectedQuote())}
source
diff --git a/frontend/src/ts/states/quote-rate.ts b/frontend/src/ts/states/quote-rate.ts index 48f86bbc0a4b..5623f429e787 100644 --- a/frontend/src/ts/states/quote-rate.ts +++ b/frontend/src/ts/states/quote-rate.ts @@ -76,8 +76,7 @@ export function showQuoteRateModal(quote: Quote): void { showModal("QuoteRate"); } -export function getLengthDesc(quoteToCheck?: Quote): QuoteLength | "-" { - const quote = quoteToCheck ?? selectedQuote(); +export function getLengthDesc(quote: Quote | null): QuoteLength | "-" { if (!quote) return "-"; if (quote.group === 0) return "short"; if (quote.group === 1) return "medium"; From 439feeff5491a9d955739792c193032597c89d5d Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 21:14:09 +0300 Subject: [PATCH 04/24] Review --- frontend/src/ts/components/modals/QuoteRateModal.tsx | 3 +-- .../src/ts/components/modals/QuoteSearchModal.tsx | 3 +-- frontend/src/ts/controllers/quotes-controller.ts | 12 +++++++++++- frontend/src/ts/states/quote-rate.ts | 10 ---------- frontend/src/ts/types/quotes.ts | 3 ++- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/frontend/src/ts/components/modals/QuoteRateModal.tsx b/frontend/src/ts/components/modals/QuoteRateModal.tsx index 29e92dce09d0..acd558d90585 100644 --- a/frontend/src/ts/components/modals/QuoteRateModal.tsx +++ b/frontend/src/ts/components/modals/QuoteRateModal.tsx @@ -16,7 +16,6 @@ import { getQuoteStats, updateQuoteStats, getRatingAverage, - getLengthDesc, } from "../../states/quote-rate"; import { cn } from "../../utils/cn"; import { qs } from "../../utils/dom"; @@ -143,7 +142,7 @@ export function QuoteRateModal(): JSXElement {
length
- {getLengthDesc(selectedQuote())} + {selectedQuote()?.groupDescription ?? "-"}
source
diff --git a/frontend/src/ts/components/modals/QuoteSearchModal.tsx b/frontend/src/ts/components/modals/QuoteSearchModal.tsx index af9b96003a63..8c0c67e37547 100644 --- a/frontend/src/ts/components/modals/QuoteSearchModal.tsx +++ b/frontend/src/ts/components/modals/QuoteSearchModal.tsx @@ -27,7 +27,6 @@ import { showNoticeNotification, showErrorNotification, } from "../../states/notifications"; -import { getLengthDesc } from "../../states/quote-rate"; import { showQuoteReportModal } from "../../states/quote-report"; import { showSimpleModal } from "../../states/simple-modal"; import * as TestLogic from "../../test/test-logic"; @@ -140,7 +139,7 @@ function Item(props: {
length
- {getLengthDesc(props.quote)} + {props.quote.groupDescription}
diff --git a/frontend/src/ts/controllers/quotes-controller.ts b/frontend/src/ts/controllers/quotes-controller.ts index 4a443a425ed6..6c4b70a302b8 100644 --- a/frontend/src/ts/controllers/quotes-controller.ts +++ b/frontend/src/ts/controllers/quotes-controller.ts @@ -6,7 +6,7 @@ import * as DB from "../db"; import Ape from "../ape"; import { tryCatch } from "@monkeytype/util/trycatch"; import { Language } from "@monkeytype/schemas/languages"; -import { QuoteData } from "@monkeytype/schemas/quotes"; +import { QuoteData, QuoteLength } from "@monkeytype/schemas/quotes"; import { Quote as QuoteType, QuoteWithTextSplit as QuoteWithTextSplitType, @@ -28,6 +28,14 @@ const defaultQuoteCollection: QuoteCollection = { groups: [], }; +function getLengthDesc(quote: Quote): QuoteLength | "-" { + if (quote.group === 0) return "short"; + if (quote.group === 1) return "medium"; + if (quote.group === 2) return "long"; + if (quote.group === 3) return "thicc"; + return "-"; +} + class QuotesController { private quoteCollection: QuoteCollection = defaultQuoteCollection; @@ -77,6 +85,7 @@ class QuotesController { id: quote.id, language: data.language, group: 0, + groupDescription: "-", }; this.quoteCollection.quotes.push(monkeyTypeQuote); @@ -90,6 +99,7 @@ class QuotesController { this.quoteCollection.quotes.filter((quote) => { if (quote.length >= lower && quote.length <= upper) { quote.group = groupIndex; + quote.groupDescription = getLengthDesc(quote); return true; } return false; diff --git a/frontend/src/ts/states/quote-rate.ts b/frontend/src/ts/states/quote-rate.ts index 5623f429e787..ce030c74dbeb 100644 --- a/frontend/src/ts/states/quote-rate.ts +++ b/frontend/src/ts/states/quote-rate.ts @@ -5,7 +5,6 @@ import { Quote } from "../controllers/quotes-controller"; import { showErrorNotification } from "./notifications"; import { showModal } from "./modals"; import { isSafeNumber } from "@monkeytype/util/numbers"; -import { QuoteLength } from "@monkeytype/schemas/quotes"; type QuoteStats = { average?: number; @@ -75,12 +74,3 @@ export function showQuoteRateModal(quote: Quote): void { setSelectedQuote(quote); showModal("QuoteRate"); } - -export function getLengthDesc(quote: Quote | null): QuoteLength | "-" { - if (!quote) return "-"; - if (quote.group === 0) return "short"; - if (quote.group === 1) return "medium"; - if (quote.group === 2) return "long"; - if (quote.group === 3) return "thicc"; - return "-"; -} diff --git a/frontend/src/ts/types/quotes.ts b/frontend/src/ts/types/quotes.ts index a7d95b6a0b2e..5abb26e2693e 100644 --- a/frontend/src/ts/types/quotes.ts +++ b/frontend/src/ts/types/quotes.ts @@ -1,9 +1,10 @@ import { Language } from "@monkeytype/schemas/languages"; -import { QuoteDataQuote } from "@monkeytype/schemas/quotes"; +import { QuoteDataQuote, QuoteLength } from "@monkeytype/schemas/quotes"; import { RequiredProperties } from "../utils/misc"; export type Quote = QuoteDataQuote & { group: number; + groupDescription: QuoteLength | "-"; language: Language; textSplit?: string[]; }; From 927c417542013d322a525d0fb3ec922305fad8ce Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 21:19:32 +0300 Subject: [PATCH 05/24] Review --- frontend/src/ts/test/result.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/ts/test/result.ts b/frontend/src/ts/test/result.ts index 8eee8ed25745..bbd69317de3e 100644 --- a/frontend/src/ts/test/result.ts +++ b/frontend/src/ts/test/result.ts @@ -784,7 +784,7 @@ function updateTestType(randomQuote: Quote | null): void { testType += ` ${Config.words}`; } else if (Config.mode === "quote") { if (randomQuote?.group !== undefined) { - testType += ` ${["short", "medium", "long", "thicc"][randomQuote.group]}`; + testType += ` ${randomQuote.groupDescription}`; } } const ignoresLanguage = isFunboxActiveWithProperty("ignoresLanguage"); From 9baed82be6e81446c1816cec4fcad0e061e0e07d Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 21:23:26 +0300 Subject: [PATCH 06/24] Remember to kill fehmer (kill means say thank you) From e2681fe4ac96129cb94363cd3b1de5857258b45d Mon Sep 17 00:00:00 2001 From: Christian Fehmer Date: Wed, 10 Jun 2026 20:25:15 +0200 Subject: [PATCH 07/24] reported From 9d54c728306622bef1d9c6dddab513ca1b66a83b Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 21:26:21 +0300 Subject: [PATCH 08/24] Remember to apologize to fehmer (apologize means to do nothing) From a9c3478e343892df06d1a30b1e6a2cb78af5afa6 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 22:01:41 +0300 Subject: [PATCH 09/24] Review --- .../ts/components/modals/MobileTestConfigModal.tsx | 9 +++++---- frontend/src/ts/controllers/quotes-controller.ts | 13 ++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx index dd16f99e979c..88aa2e4dfcee 100644 --- a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx +++ b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx @@ -8,6 +8,7 @@ import { For, JSXElement, Show } from "solid-js"; import { setConfig, setQuoteLengthAll } from "../../config/setters"; import { getConfig } from "../../config/store"; +import { groupToDesc } from "../../controllers/quotes-controller"; import { restartTestEvent } from "../../events/test"; import { isAuthenticated } from "../../states/core"; import { showModal } from "../../states/modals"; @@ -26,10 +27,10 @@ const quoteLengths: { loginRequired?: boolean; }[] = [ { value: "all", label: "all" }, - { value: "0", label: "short" }, - { value: "1", label: "medium" }, - { value: "2", label: "long" }, - { value: "3", label: "thicc" }, + ...Object.entries(groupToDesc).map(([key, objectValue]) => ({ + value: key, + label: objectValue, + })), { value: "-3", label: "favorite", loginRequired: true }, { value: "-2", label: "search" }, ] as const; diff --git a/frontend/src/ts/controllers/quotes-controller.ts b/frontend/src/ts/controllers/quotes-controller.ts index 6c4b70a302b8..981c548fc55d 100644 --- a/frontend/src/ts/controllers/quotes-controller.ts +++ b/frontend/src/ts/controllers/quotes-controller.ts @@ -28,12 +28,15 @@ const defaultQuoteCollection: QuoteCollection = { groups: [], }; +export const groupToDesc: Record = { + 0: "short", + 1: "medium", + 2: "long", + 3: "thicc", +} as const; + function getLengthDesc(quote: Quote): QuoteLength | "-" { - if (quote.group === 0) return "short"; - if (quote.group === 1) return "medium"; - if (quote.group === 2) return "long"; - if (quote.group === 3) return "thicc"; - return "-"; + return groupToDesc[quote.group] ?? "-"; } class QuotesController { From 9ecfb8ba0de9b2cbb6b301fd7f0e783cc0c6dbb2 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 22:10:17 +0300 Subject: [PATCH 10/24] Review --- frontend/src/ts/collections/results.ts | 9 ++------- .../ts/components/modals/MobileTestConfigModal.tsx | 2 +- frontend/src/ts/controllers/quotes-controller.ts | 8 +------- frontend/src/ts/utils/misc.ts | 13 +++++++++++++ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/frontend/src/ts/collections/results.ts b/frontend/src/ts/collections/results.ts index 3650bef1ef1a..4bf5f6c52e91 100644 --- a/frontend/src/ts/collections/results.ts +++ b/frontend/src/ts/collections/results.ts @@ -38,7 +38,7 @@ import { } from "./tags"; import { applyIdWorkaround } from "./utils/misc"; import { getConfig } from "../config/store"; -import { getMode2 } from "../utils/misc"; +import { getMode2, descToGroup } from "../utils/misc"; import { getCurrentQuote } from "../states/test"; export type ResultsQueryState = { @@ -497,12 +497,7 @@ export function createResultsQueryState( numbers: boolFilter(filters.numbers), timestamp: timestampFilter(filters.date), quoteLength: [ - ...valueFilter(filters.quoteLength, { - short: 0, - medium: 1, - long: 2, - thicc: 3, - }), + ...valueFilter(filters.quoteLength, descToGroup), -1, // fallback value for results without quoteLength, set in the collection ], tags: valueFilter(filters.tags), diff --git a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx index 88aa2e4dfcee..8b08755ce820 100644 --- a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx +++ b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx @@ -8,11 +8,11 @@ import { For, JSXElement, Show } from "solid-js"; import { setConfig, setQuoteLengthAll } from "../../config/setters"; import { getConfig } from "../../config/store"; -import { groupToDesc } from "../../controllers/quotes-controller"; import { restartTestEvent } from "../../events/test"; import { isAuthenticated } from "../../states/core"; import { showModal } from "../../states/modals"; import { areUnsortedArraysEqual } from "../../utils/arrays"; +import { groupToDesc } from "../../utils/misc"; import { AnimatedModal } from "../common/AnimatedModal"; import { Button } from "../common/Button"; import { Separator } from "../common/Separator"; diff --git a/frontend/src/ts/controllers/quotes-controller.ts b/frontend/src/ts/controllers/quotes-controller.ts index 981c548fc55d..e93bc2fcb402 100644 --- a/frontend/src/ts/controllers/quotes-controller.ts +++ b/frontend/src/ts/controllers/quotes-controller.ts @@ -11,6 +11,7 @@ import { Quote as QuoteType, QuoteWithTextSplit as QuoteWithTextSplitType, } from "../types/quotes"; +import { groupToDesc } from "../utils/misc"; export type Quote = QuoteType; export type QuoteWithTextSplit = QuoteWithTextSplitType; @@ -28,13 +29,6 @@ const defaultQuoteCollection: QuoteCollection = { groups: [], }; -export const groupToDesc: Record = { - 0: "short", - 1: "medium", - 2: "long", - 3: "thicc", -} as const; - function getLengthDesc(quote: Quote): QuoteLength | "-" { return groupToDesc[quote.group] ?? "-"; } diff --git a/frontend/src/ts/utils/misc.ts b/frontend/src/ts/utils/misc.ts index 6480e38ae000..f6b414de2a7e 100644 --- a/frontend/src/ts/utils/misc.ts +++ b/frontend/src/ts/utils/misc.ts @@ -7,6 +7,7 @@ import { roundTo2 } from "@monkeytype/util/numbers"; import { animate, AnimationParams } from "animejs"; import { ElementWithUtils } from "./dom"; import { isDevEnvironment } from "./env"; +import { QuoteLength } from "@monkeytype/schemas/quotes"; export function whorf(speed: number, wordlen: number): number { return Math.min( @@ -747,4 +748,16 @@ export function getTotalInlineMargin(element: HTMLElement): number { ); } +export const groupToDesc: Record = { + 0: "short", + 1: "medium", + 2: "long", + 3: "thicc", +} as const; + +export const descToGroup = Object.entries(groupToDesc).map(([key, value]) => [ + value, + key, +]) as unknown as Record; + // DO NOT ALTER GLOBAL OBJECTSONSTRUCTOR, IT WILL BREAK RESULT HASHES From 7f138cfa8fadac2ff2eb3db01bc4514f4603478c Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 22:27:43 +0300 Subject: [PATCH 11/24] Review --- frontend/src/ts/utils/misc.ts | 13 +++---------- packages/schemas/src/quotes.ts | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/src/ts/utils/misc.ts b/frontend/src/ts/utils/misc.ts index f6b414de2a7e..7eb78cd8272d 100644 --- a/frontend/src/ts/utils/misc.ts +++ b/frontend/src/ts/utils/misc.ts @@ -7,7 +7,7 @@ import { roundTo2 } from "@monkeytype/util/numbers"; import { animate, AnimationParams } from "animejs"; import { ElementWithUtils } from "./dom"; import { isDevEnvironment } from "./env"; -import { QuoteLength } from "@monkeytype/schemas/quotes"; +import { QuoteLength, descToGroup } from "@monkeytype/schemas/quotes"; export function whorf(speed: number, wordlen: number): number { return Math.min( @@ -748,16 +748,9 @@ export function getTotalInlineMargin(element: HTMLElement): number { ); } -export const groupToDesc: Record = { - 0: "short", - 1: "medium", - 2: "long", - 3: "thicc", -} as const; - -export const descToGroup = Object.entries(groupToDesc).map(([key, value]) => [ +export const groupToDesc = Object.entries(descToGroup).map(([key, value]) => [ value, key, -]) as unknown as Record; +]) as unknown as Record; // DO NOT ALTER GLOBAL OBJECTSONSTRUCTOR, IT WILL BREAK RESULT HASHES diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index b5f1d2a2323b..cff34f5b7c6f 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -9,12 +9,19 @@ export const QuoteIdSchema = z .or(z.string().regex(/^\d+$/).transform(Number)); export type QuoteId = z.infer; -export const QuoteLengthSchema = z.union([ - z.literal("short"), - z.literal("medium"), - z.literal("long"), - z.literal("thicc"), -]); +export const descToGroup = { + short: 0, + medium: 1, + long: 2, + thicc: 3, +} as const; + +export const QuoteLengthKeysSchema = Object.keys(descToGroup) as [ + keyof typeof descToGroup, + ...string[], +]; + +export const QuoteLengthSchema = z.enum(QuoteLengthKeysSchema); export type QuoteLength = z.infer; From fd6196ed51582137f1a1021fa36bff981f9be0ff Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 22:31:29 +0300 Subject: [PATCH 12/24] Native enum --- packages/schemas/src/quotes.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index cff34f5b7c6f..89355e00fa2e 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -16,12 +16,7 @@ export const descToGroup = { thicc: 3, } as const; -export const QuoteLengthKeysSchema = Object.keys(descToGroup) as [ - keyof typeof descToGroup, - ...string[], -]; - -export const QuoteLengthSchema = z.enum(QuoteLengthKeysSchema); +export const QuoteLengthSchema = z.nativeEnum(descToGroup); export type QuoteLength = z.infer; From 7fca9abd7dc7d0e4d22a247e44f05f7d8953c95e Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Wed, 10 Jun 2026 22:33:26 +0300 Subject: [PATCH 13/24] t Revert "Native enum" This reverts commit fd6196ed51582137f1a1021fa36bff981f9be0ff. --- packages/schemas/src/quotes.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index 89355e00fa2e..cff34f5b7c6f 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -16,7 +16,12 @@ export const descToGroup = { thicc: 3, } as const; -export const QuoteLengthSchema = z.nativeEnum(descToGroup); +export const QuoteLengthKeysSchema = Object.keys(descToGroup) as [ + keyof typeof descToGroup, + ...string[], +]; + +export const QuoteLengthSchema = z.enum(QuoteLengthKeysSchema); export type QuoteLength = z.infer; From d410602a928ec9207ca413180f9b4dcac9a4c0d3 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:17:56 +0300 Subject: [PATCH 14/24] Remove cast --- frontend/src/ts/utils/misc.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/ts/utils/misc.ts b/frontend/src/ts/utils/misc.ts index 7eb78cd8272d..4da16c8d56c8 100644 --- a/frontend/src/ts/utils/misc.ts +++ b/frontend/src/ts/utils/misc.ts @@ -7,7 +7,7 @@ import { roundTo2 } from "@monkeytype/util/numbers"; import { animate, AnimationParams } from "animejs"; import { ElementWithUtils } from "./dom"; import { isDevEnvironment } from "./env"; -import { QuoteLength, descToGroup } from "@monkeytype/schemas/quotes"; +import { descToGroup } from "@monkeytype/schemas/quotes"; export function whorf(speed: number, wordlen: number): number { return Math.min( @@ -751,6 +751,6 @@ export function getTotalInlineMargin(element: HTMLElement): number { export const groupToDesc = Object.entries(descToGroup).map(([key, value]) => [ value, key, -]) as unknown as Record; +]); // DO NOT ALTER GLOBAL OBJECTSONSTRUCTOR, IT WILL BREAK RESULT HASHES From 5b64d8c1b60ce7fe0ec43d6a0592d977d54671bd Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:34:35 +0300 Subject: [PATCH 15/24] Move + cast --- frontend/src/ts/collections/results.ts | 3 ++- .../src/ts/components/modals/MobileTestConfigModal.tsx | 2 +- frontend/src/ts/controllers/quotes-controller.ts | 7 +++++-- frontend/src/ts/utils/misc.ts | 6 ------ packages/schemas/src/quotes.ts | 5 +++++ 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/frontend/src/ts/collections/results.ts b/frontend/src/ts/collections/results.ts index 4bf5f6c52e91..edd39f570da6 100644 --- a/frontend/src/ts/collections/results.ts +++ b/frontend/src/ts/collections/results.ts @@ -1,6 +1,7 @@ import { ResultMinified } from "@monkeytype/schemas/results"; import { Difficulty, Mode, Mode2 } from "@monkeytype/schemas/shared"; import { ResultFilters } from "@monkeytype/schemas/users"; +import { descToGroup } from "@monkeytype/schemas/quotes"; import { queryCollectionOptions } from "@tanstack/query-db-collection"; import { avg, @@ -38,7 +39,7 @@ import { } from "./tags"; import { applyIdWorkaround } from "./utils/misc"; import { getConfig } from "../config/store"; -import { getMode2, descToGroup } from "../utils/misc"; +import { getMode2 } from "../utils/misc"; import { getCurrentQuote } from "../states/test"; export type ResultsQueryState = { diff --git a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx index 8b08755ce820..0cd1008b86b6 100644 --- a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx +++ b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx @@ -4,6 +4,7 @@ import type { } from "@monkeytype/schemas/configs"; import type { Mode } from "@monkeytype/schemas/shared"; +import { groupToDesc } from "@monkeytype/schemas/quotes"; import { For, JSXElement, Show } from "solid-js"; import { setConfig, setQuoteLengthAll } from "../../config/setters"; @@ -12,7 +13,6 @@ import { restartTestEvent } from "../../events/test"; import { isAuthenticated } from "../../states/core"; import { showModal } from "../../states/modals"; import { areUnsortedArraysEqual } from "../../utils/arrays"; -import { groupToDesc } from "../../utils/misc"; import { AnimatedModal } from "../common/AnimatedModal"; import { Button } from "../common/Button"; import { Separator } from "../common/Separator"; diff --git a/frontend/src/ts/controllers/quotes-controller.ts b/frontend/src/ts/controllers/quotes-controller.ts index e93bc2fcb402..17c4e1995b8c 100644 --- a/frontend/src/ts/controllers/quotes-controller.ts +++ b/frontend/src/ts/controllers/quotes-controller.ts @@ -6,12 +6,15 @@ import * as DB from "../db"; import Ape from "../ape"; import { tryCatch } from "@monkeytype/util/trycatch"; import { Language } from "@monkeytype/schemas/languages"; -import { QuoteData, QuoteLength } from "@monkeytype/schemas/quotes"; +import { + QuoteData, + QuoteLength, + groupToDesc, +} from "@monkeytype/schemas/quotes"; import { Quote as QuoteType, QuoteWithTextSplit as QuoteWithTextSplitType, } from "../types/quotes"; -import { groupToDesc } from "../utils/misc"; export type Quote = QuoteType; export type QuoteWithTextSplit = QuoteWithTextSplitType; diff --git a/frontend/src/ts/utils/misc.ts b/frontend/src/ts/utils/misc.ts index 4da16c8d56c8..6480e38ae000 100644 --- a/frontend/src/ts/utils/misc.ts +++ b/frontend/src/ts/utils/misc.ts @@ -7,7 +7,6 @@ import { roundTo2 } from "@monkeytype/util/numbers"; import { animate, AnimationParams } from "animejs"; import { ElementWithUtils } from "./dom"; import { isDevEnvironment } from "./env"; -import { descToGroup } from "@monkeytype/schemas/quotes"; export function whorf(speed: number, wordlen: number): number { return Math.min( @@ -748,9 +747,4 @@ export function getTotalInlineMargin(element: HTMLElement): number { ); } -export const groupToDesc = Object.entries(descToGroup).map(([key, value]) => [ - value, - key, -]); - // DO NOT ALTER GLOBAL OBJECTSONSTRUCTOR, IT WILL BREAK RESULT HASHES diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index cff34f5b7c6f..6259a2e79596 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -25,6 +25,11 @@ export const QuoteLengthSchema = z.enum(QuoteLengthKeysSchema); export type QuoteLength = z.infer; +export const groupToDesc = Object.entries(descToGroup).map(([key, value]) => [ + value, + key, +]) as unknown as Record; + export const ApproveQuoteSchema = z.object({ id: QuoteIdSchema, text: z.string(), From c8dd08312f048d1083f895b057e5660e6e555f48 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:37:54 +0300 Subject: [PATCH 16/24] Rename --- packages/schemas/src/quotes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index 6259a2e79596..6fce2a5372ac 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -16,12 +16,12 @@ export const descToGroup = { thicc: 3, } as const; -export const QuoteLengthKeysSchema = Object.keys(descToGroup) as [ +export const quoteLengthKeys = Object.keys(descToGroup) as [ keyof typeof descToGroup, ...string[], ]; -export const QuoteLengthSchema = z.enum(QuoteLengthKeysSchema); +export const QuoteLengthSchema = z.enum(quoteLengthKeys); export type QuoteLength = z.infer; From bd5621c80327751c1ea45c68cc8805b07c960f69 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:42:35 +0300 Subject: [PATCH 17/24] Yes --- packages/schemas/src/quotes.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index 6fce2a5372ac..1672fd521051 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -18,9 +18,7 @@ export const descToGroup = { export const quoteLengthKeys = Object.keys(descToGroup) as [ keyof typeof descToGroup, - ...string[], ]; - export const QuoteLengthSchema = z.enum(quoteLengthKeys); export type QuoteLength = z.infer; From a025c3108e1d6e7886e98fb86e80d1f3cae90ac4 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:51:41 +0300 Subject: [PATCH 18/24] More --- .../ts/components/pages/test/TestConfig.tsx | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/frontend/src/ts/components/pages/test/TestConfig.tsx b/frontend/src/ts/components/pages/test/TestConfig.tsx index bdf42cbd9012..7d9b8072b69c 100644 --- a/frontend/src/ts/components/pages/test/TestConfig.tsx +++ b/frontend/src/ts/components/pages/test/TestConfig.tsx @@ -1,3 +1,4 @@ +import { descToGroup, QuoteLength } from "@monkeytype/schemas/quotes"; import { ComponentProps, For, JSXElement, Show } from "solid-js"; import { configMetadata } from "../../../config/metadata"; @@ -303,13 +304,6 @@ function Mode2Words(props: ComponentProps<"div">): JSXElement { } function Mode2Quote(props: ComponentProps<"div">): JSXElement { - const quoteLengths = [ - { text: "short", length: 0 }, - { text: "medium", length: 1 }, - { text: "long", length: 2 }, - { text: "thicc", length: 3 }, - ] as const; - return (
): JSXElement { restartTestEvent.dispatch(); }} /> - - {({ text, length }) => ( + + {(desc) => ( { - setConfig("quoteLength", [length]); + setConfig("quoteLength", [descToGroup[desc as QuoteLength]]); restartTestEvent.dispatch(); }} /> From 966ba29294b3d18af725b6936929f937ff874954 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 16:49:23 +0300 Subject: [PATCH 19/24] Merge --- packages/schemas/src/quotes.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index 1672fd521051..e66e0b425281 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -16,10 +16,9 @@ export const descToGroup = { thicc: 3, } as const; -export const quoteLengthKeys = Object.keys(descToGroup) as [ - keyof typeof descToGroup, -]; -export const QuoteLengthSchema = z.enum(quoteLengthKeys); +export const QuoteLengthSchema = z.enum( + Object.keys(descToGroup) as [keyof typeof descToGroup], +); export type QuoteLength = z.infer; From fd2bf07a6b5ba038ecbcf94a17653df922e50c0b Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 17:02:39 +0300 Subject: [PATCH 20/24] Rename --- frontend/src/ts/collections/results.ts | 4 ++-- .../ts/components/modals/MobileTestConfigModal.tsx | 4 ++-- frontend/src/ts/components/pages/test/TestConfig.tsx | 8 ++++---- frontend/src/ts/controllers/quotes-controller.ts | 4 ++-- packages/schemas/src/quotes.ts | 11 +++++------ 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/frontend/src/ts/collections/results.ts b/frontend/src/ts/collections/results.ts index edd39f570da6..fbce9bab39a0 100644 --- a/frontend/src/ts/collections/results.ts +++ b/frontend/src/ts/collections/results.ts @@ -1,7 +1,7 @@ import { ResultMinified } from "@monkeytype/schemas/results"; import { Difficulty, Mode, Mode2 } from "@monkeytype/schemas/shared"; import { ResultFilters } from "@monkeytype/schemas/users"; -import { descToGroup } from "@monkeytype/schemas/quotes"; +import { quoteDescToGroup } from "@monkeytype/schemas/quotes"; import { queryCollectionOptions } from "@tanstack/query-db-collection"; import { avg, @@ -498,7 +498,7 @@ export function createResultsQueryState( numbers: boolFilter(filters.numbers), timestamp: timestampFilter(filters.date), quoteLength: [ - ...valueFilter(filters.quoteLength, descToGroup), + ...valueFilter(filters.quoteLength, quoteDescToGroup), -1, // fallback value for results without quoteLength, set in the collection ], tags: valueFilter(filters.tags), diff --git a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx index 0cd1008b86b6..bc1d9ec84d4b 100644 --- a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx +++ b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx @@ -4,7 +4,7 @@ import type { } from "@monkeytype/schemas/configs"; import type { Mode } from "@monkeytype/schemas/shared"; -import { groupToDesc } from "@monkeytype/schemas/quotes"; +import { quoteGroupToDesc } from "@monkeytype/schemas/quotes"; import { For, JSXElement, Show } from "solid-js"; import { setConfig, setQuoteLengthAll } from "../../config/setters"; @@ -27,7 +27,7 @@ const quoteLengths: { loginRequired?: boolean; }[] = [ { value: "all", label: "all" }, - ...Object.entries(groupToDesc).map(([key, objectValue]) => ({ + ...Object.entries(quoteGroupToDesc).map(([key, objectValue]) => ({ value: key, label: objectValue, })), diff --git a/frontend/src/ts/components/pages/test/TestConfig.tsx b/frontend/src/ts/components/pages/test/TestConfig.tsx index 7d9b8072b69c..7ceea91a53cf 100644 --- a/frontend/src/ts/components/pages/test/TestConfig.tsx +++ b/frontend/src/ts/components/pages/test/TestConfig.tsx @@ -1,4 +1,4 @@ -import { descToGroup, QuoteLength } from "@monkeytype/schemas/quotes"; +import { quoteDescToGroup, QuoteLength } from "@monkeytype/schemas/quotes"; import { ComponentProps, For, JSXElement, Show } from "solid-js"; import { configMetadata } from "../../../config/metadata"; @@ -314,15 +314,15 @@ function Mode2Quote(props: ComponentProps<"div">): JSXElement { restartTestEvent.dispatch(); }} /> - + {(desc) => ( { - setConfig("quoteLength", [descToGroup[desc as QuoteLength]]); + setConfig("quoteLength", [quoteDescToGroup[desc as QuoteLength]]); restartTestEvent.dispatch(); }} /> diff --git a/frontend/src/ts/controllers/quotes-controller.ts b/frontend/src/ts/controllers/quotes-controller.ts index 17c4e1995b8c..ece079f68596 100644 --- a/frontend/src/ts/controllers/quotes-controller.ts +++ b/frontend/src/ts/controllers/quotes-controller.ts @@ -9,7 +9,7 @@ import { Language } from "@monkeytype/schemas/languages"; import { QuoteData, QuoteLength, - groupToDesc, + quoteGroupToDesc, } from "@monkeytype/schemas/quotes"; import { Quote as QuoteType, @@ -33,7 +33,7 @@ const defaultQuoteCollection: QuoteCollection = { }; function getLengthDesc(quote: Quote): QuoteLength | "-" { - return groupToDesc[quote.group] ?? "-"; + return quoteGroupToDesc[quote.group] ?? "-"; } class QuotesController { diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index e66e0b425281..21395d66e08a 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -9,7 +9,7 @@ export const QuoteIdSchema = z .or(z.string().regex(/^\d+$/).transform(Number)); export type QuoteId = z.infer; -export const descToGroup = { +export const quoteDescToGroup = { short: 0, medium: 1, long: 2, @@ -17,15 +17,14 @@ export const descToGroup = { } as const; export const QuoteLengthSchema = z.enum( - Object.keys(descToGroup) as [keyof typeof descToGroup], + Object.keys(quoteDescToGroup) as [keyof typeof quoteDescToGroup], ); export type QuoteLength = z.infer; -export const groupToDesc = Object.entries(descToGroup).map(([key, value]) => [ - value, - key, -]) as unknown as Record; +export const quoteGroupToDesc = Object.entries(quoteDescToGroup).map( + ([key, value]) => [value, key], +) as unknown as Record; export const ApproveQuoteSchema = z.object({ id: QuoteIdSchema, From 01878db41af1d95b83e39529542c050ff9812176 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 17:23:55 +0300 Subject: [PATCH 21/24] Remove const assertion --- frontend/src/ts/components/modals/MobileTestConfigModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx index bc1d9ec84d4b..ee7cbe38ece6 100644 --- a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx +++ b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx @@ -33,7 +33,7 @@ const quoteLengths: { })), { value: "-3", label: "favorite", loginRequired: true }, { value: "-2", label: "search" }, -] as const; +]; function MCButton(props: { text: string; From 65824c06f3d87a09d4bdcce3b5437e8a8eb1ff78 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 17:30:25 +0300 Subject: [PATCH 22/24] Rename --- frontend/src/ts/components/modals/MobileTestConfigModal.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx index ee7cbe38ece6..9d348cf72777 100644 --- a/frontend/src/ts/components/modals/MobileTestConfigModal.tsx +++ b/frontend/src/ts/components/modals/MobileTestConfigModal.tsx @@ -27,9 +27,9 @@ const quoteLengths: { loginRequired?: boolean; }[] = [ { value: "all", label: "all" }, - ...Object.entries(quoteGroupToDesc).map(([key, objectValue]) => ({ - value: key, - label: objectValue, + ...Object.entries(quoteGroupToDesc).map(([group, desc]) => ({ + value: group, + label: desc, })), { value: "-3", label: "favorite", loginRequired: true }, { value: "-2", label: "search" }, From 8ec6da30a61a0e0887530ff4157722ba0c2a2957 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 17:34:46 +0300 Subject: [PATCH 23/24] Rename --- packages/schemas/src/quotes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index 21395d66e08a..9025e691f57b 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -23,7 +23,7 @@ export const QuoteLengthSchema = z.enum( export type QuoteLength = z.infer; export const quoteGroupToDesc = Object.entries(quoteDescToGroup).map( - ([key, value]) => [value, key], + ([desc, group]) => [group, desc], ) as unknown as Record; export const ApproveQuoteSchema = z.object({ From ed50376bd9159f2874d77cdf9b0c4dd9db26ff5b Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Thu, 11 Jun 2026 17:40:43 +0300 Subject: [PATCH 24/24] Fix --- packages/schemas/src/quotes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/schemas/src/quotes.ts b/packages/schemas/src/quotes.ts index 9025e691f57b..046581d5078a 100644 --- a/packages/schemas/src/quotes.ts +++ b/packages/schemas/src/quotes.ts @@ -22,8 +22,8 @@ export const QuoteLengthSchema = z.enum( export type QuoteLength = z.infer; -export const quoteGroupToDesc = Object.entries(quoteDescToGroup).map( - ([desc, group]) => [group, desc], +export const quoteGroupToDesc = Object.fromEntries( + Object.entries(quoteDescToGroup).map(([desc, group]) => [group, desc]), ) as unknown as Record; export const ApproveQuoteSchema = z.object({