mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-21 07:46:15 +08:00
Merge branch 'master' into newads
This commit is contained in:
commit
c5b4fc6be9
|
@ -17,8 +17,39 @@ import format from "date-fns/format";
|
|||
import { Auth } from "../firebase";
|
||||
import { skipXpBreakdown } from "../elements/account-button";
|
||||
import * as FunboxList from "./funbox/funbox-list";
|
||||
import { debounce } from "throttle-debounce";
|
||||
|
||||
const debouncedZipfCheck = debounce(250, () => {
|
||||
Misc.checkIfLanguageSupportsZipf(Config.language).then((supports) => {
|
||||
if (supports === "no") {
|
||||
Notifications.add(
|
||||
`${Misc.capitalizeFirstLetter(
|
||||
Config.language.replace(/_/g, " ")
|
||||
)} does not support Zipf funbox, because the list is not ordered by frequency. Please try another word list.`,
|
||||
0,
|
||||
7
|
||||
);
|
||||
}
|
||||
if (supports === "unknown") {
|
||||
Notifications.add(
|
||||
`${Misc.capitalizeFirstLetter(
|
||||
Config.language.replace(/_/g, " ")
|
||||
)} may not support Zipf funbox, because we don't know if it's ordered by frequency or not. If you would like to add this label, please contact us.`,
|
||||
0,
|
||||
7
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ConfigEvent.subscribe((eventKey, eventValue) => {
|
||||
if (
|
||||
(eventKey === "language" || eventKey === "funbox") &&
|
||||
(eventValue as string).split("#").includes("zipf")
|
||||
) {
|
||||
debouncedZipfCheck();
|
||||
}
|
||||
|
||||
if (eventValue === undefined || typeof eventValue !== "boolean") return;
|
||||
if (eventKey === "flipTestColors") flipColors(eventValue);
|
||||
if (eventKey === "colorfulMode") colorful(eventValue);
|
||||
|
|
1
frontend/src/ts/types/types.d.ts
vendored
1
frontend/src/ts/types/types.d.ts
vendored
|
@ -23,6 +23,7 @@ declare namespace MonkeyTypes {
|
|||
leftToRight: boolean;
|
||||
noLazyMode?: boolean;
|
||||
ligatures?: boolean;
|
||||
orderedByFrequency?: boolean;
|
||||
words: string[];
|
||||
accents: Accents;
|
||||
bcp47?: string;
|
||||
|
|
|
@ -1402,3 +1402,12 @@ export function dreymarIndex(arrayLength: number): number {
|
|||
const W = Math.ceil(h);
|
||||
return W - 1;
|
||||
}
|
||||
|
||||
export async function checkIfLanguageSupportsZipf(
|
||||
language: string
|
||||
): Promise<"yes" | "no" | "unknown"> {
|
||||
const lang = await getLanguage(language);
|
||||
if (lang.orderedByFrequency === true) return "yes";
|
||||
if (lang.orderedByFrequency === false) return "no";
|
||||
return "unknown";
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"name": "english",
|
||||
"leftToRight": true,
|
||||
"noLazyMode": true,
|
||||
"orderedByFrequency": true,
|
||||
"words": [
|
||||
"the",
|
||||
"be",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"name": "english_10k",
|
||||
"leftToRight": true,
|
||||
"noLazyMode": true,
|
||||
"orderedByFrequency": true,
|
||||
"words": [
|
||||
"the",
|
||||
"of",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"name": "english_1k",
|
||||
"leftToRight": true,
|
||||
"noLazyMode": true,
|
||||
"orderedByFrequency": true,
|
||||
"words": [
|
||||
"the",
|
||||
"of",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"name": "english_25k",
|
||||
"leftToRight": true,
|
||||
"noLazyMode": true,
|
||||
"orderedByFrequency": false,
|
||||
"words": [
|
||||
"plug",
|
||||
"rounders",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"name": "english_450k",
|
||||
"leftToRight": true,
|
||||
"noLazyMode": true,
|
||||
"orderedByFrequency": false,
|
||||
"words": [
|
||||
"a",
|
||||
"AA",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"name": "english_5k",
|
||||
"leftToRight": true,
|
||||
"noLazyMode": true,
|
||||
"orderedByFrequency": false,
|
||||
"words": [
|
||||
"a",
|
||||
"abandon",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"leftToRight": true,
|
||||
"_comment": "Sourced from: https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings",
|
||||
"noLazyMode": true,
|
||||
"orderedByFrequency": false,
|
||||
"words": [
|
||||
"caused",
|
||||
"ultimately",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"leftToRight": true,
|
||||
"_comment": "Sourced from: https://en.wikipedia.org/wiki/Wikipedia:List_of_English_contractions",
|
||||
"noLazyMode": true,
|
||||
"orderedByFrequency": false,
|
||||
"words": [
|
||||
"a'ight",
|
||||
"ain't",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"_comment": "Sourced from https://www.panopy.com/iphone/secret-ada/double-letter-words.html and https://grammar.yourdictionary.com/word-lists/words-with-double-letters.html",
|
||||
"ligatures": false,
|
||||
"noLazyMode": true,
|
||||
"orderedByFrequency": false,
|
||||
"bcp47": "en-US",
|
||||
"words": [
|
||||
"been",
|
||||
|
|
Loading…
Reference in a new issue