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
12 changes: 6 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Checks

- [ ] Adding quotes?
- Make sure to follow the [quotes documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/QUOTES.md)
- [ ] Make sure to include translations for the quotes in the description (or another comment) so we can verify their content.
- [ ] Adding a language?
- Make sure to follow the [languages documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/LANGUAGES.md)
Expand Down Expand Up @@ -32,14 +33,13 @@

<!-- label(optional scope): pull request title (@your_github_username) -->

<!-- I know I know they seem boring but please do them, they help us and you will find out it also helps you.-->
<!-- I know I know they seem boring but please do them, they help us and you will find out it also helps you. -->

Closes #

<!-- the issue(s) your PR resolves if any (delete if that is not the case) -->
<!-- please also reference any issues and or PRs related to your pull request -->
<!-- Also remove it if you are not following any issues. -->
<!-- The issue(s) your PR resolves if any (delete if that is not the case) -->
<!-- Please reference any issues and/or PRs related to your pull request -->

<!-- pro tip: you can mention an issue, PR, or discussion on GitHub by referencing its hash number e.g: [#1234](https://github.com/monkeytypegame/monkeytype/pull/1234) -->
<!-- Pro tip: you can mention an issue, PR, or discussion on GitHub by referencing its hash number, e.g.: [#1234](https://github.com/monkeytypegame/monkeytype/pull/1234) -->

<!-- pro tip: you can press . (dot or period) in the code tab of any GitHub repo to get access to GitHub's VS Code web editor Enjoy! :) -->
<!-- Pro tip: you can press . (dot or period) in the code tab of any GitHub repo to get access to GitHub's VS Code web editor. Enjoy! :) -->
10 changes: 2 additions & 8 deletions frontend/scripts/check-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
Language,
LanguageObject,
LanguageObjectSchema,
LanguageSchema,
} from "@monkeytype/schemas/languages";
import { Layout, ThemeName } from "@monkeytype/schemas/configs";
import { LayoutsList } from "../src/ts/constants/layouts";
Expand Down Expand Up @@ -154,7 +153,7 @@ async function validateQuotes(): Promise<void> {

const shortQuotes = JSON.parse(
fs.readFileSync("./scripts/short-quotes.json", "utf8"),
) as Partial<Record<QuoteData["language"], number[]>>;
) as Record<QuoteData["language"], number[]>;

const quotesFiles = fs.readdirSync("./static/quotes/");
for (let quotefilename of quotesFiles) {
Expand Down Expand Up @@ -185,12 +184,7 @@ async function validateQuotes(): Promise<void> {
}

//check schema
const schema = QuoteDataSchema.extend({
language: LanguageSchema
//icelandic only exists as icelandic_1k, language in quote file is stripped of its size
.or(z.literal("icelandic")),
});
problems.addValidation(quotefilename, schema.safeParse(quoteData));
problems.addValidation(quotefilename, QuoteDataSchema.safeParse(quoteData));

//check for duplicate ids
const duplicates = findDuplicates(quoteData.quotes.map((it) => it.id));
Expand Down
36 changes: 24 additions & 12 deletions frontend/scripts/get-short-quotes.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
import * as fs from "fs";
import { QuoteData } from "@monkeytype/schemas/quotes";
import * as fs from "fs";

import path, { dirname } from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const FRONTEND_ROOT = path.resolve(__dirname, "..");

async function getShortQuotes(): Promise<void> {
let shortQuotes: Partial<Record<QuoteData["language"], number[]>> = {};
const shortQuotes = {} as Record<QuoteData["language"], number[]>;
let count = 0;
const quotesFiles = fs.readdirSync("./static/quotes/");
const quotesFiles = fs.readdirSync(
path.resolve(FRONTEND_ROOT, "static/quotes"),
);
for (const quotefilename of quotesFiles) {
const lang = quotefilename.split(".")[0] as QuoteData["language"];
let quoteData: QuoteData;
let quoteJson: string;
quoteJson = fs.readFileSync(`./static/quotes/${lang}.json`, "utf8");
//quoteJson = await (await fetch(`https://raw.githubusercontent.com/monkeytypegame/monkeytype/refs/heads/master/frontend/static/quotes/${lang}.json`)).json();
quoteData = JSON.parse(quoteJson) as QuoteData;
const quoteJson = fs.readFileSync(
path.resolve(FRONTEND_ROOT, `static/quotes/${quotefilename}`),
"utf8",
);
//const quoteJson = await (await fetch(`https://raw.githubusercontent.com/monkeytypegame/monkeytype/refs/heads/master/frontend/static/quotes/${quotefilename}`)).json();
const quoteData = JSON.parse(quoteJson) as QuoteData;
for (const quote of quoteData.quotes) {
if (quote.length < 60) {
shortQuotes[lang] ??= [];
shortQuotes[lang].push(quote.id);
shortQuotes[quoteData.language] ??= [];
shortQuotes[quoteData.language].push(quote.id);
count++;
}
}
}
fs.writeFileSync("./scripts/short-quotes.json", JSON.stringify(shortQuotes));
fs.writeFileSync(
path.resolve(__dirname, "short-quotes.json"),
JSON.stringify(shortQuotes),
);
console.log(`There are ${count} allowed short quotes`);
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/modals/custom-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ async function beforeAnimation(

if (
state.customTextMode === "repeat" &&
CustomText.getLimitMode() === "word" &&
CustomText.getLimitMode() !== "time" &&
CustomText.getLimitValue() === CustomText.getText().length
) {
state.customTextMode = "simple";
Expand Down
1 change: 0 additions & 1 deletion frontend/static/languages/english_10k.json
Original file line number Diff line number Diff line change
Expand Up @@ -7200,7 +7200,6 @@
"undo",
"atmospheric",
"Malawi",
"knowledgestorm",
"halo",
"parental",
"referenced",
Expand Down
Loading
Loading