Skip to content

Commit 9b2a010

Browse files
albindavidcMiodec
andauthored
fix(challenge): add wingdings challenge to the list, update the controller and update notification (@albindavidc) (#7726)
### Description 1. added wingdings challenge to the list 2. updated controller 3. updated notification ### Checks - [x] Check if any open issues are related to this PR; if so, be sure to tag them below. - [x] Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info) - [x] Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title. Closes #7720 --- **Reference Image** <img width="1600" height="779" alt="image" src="https://github.com/user-attachments/assets/85e9e76c-71a1-4691-befb-5c57a84df5d9" /> --------- Co-authored-by: Jack <jack@monkeytype.com>
1 parent 358def1 commit 9b2a010

File tree

4 files changed

+46
-6
lines changed

4 files changed

+46
-6
lines changed

frontend/src/ts/controllers/challenge-controller.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ export async function setup(challengeName: string): Promise<boolean> {
341341
nosave: true,
342342
});
343343
}
344-
} else if (challenge.type === "special") {
344+
} else if (challenge.type === "other") {
345345
if (challenge.name === "semimak") {
346346
// so can you make a link that sets up 120s, 10k, punct, stop on word, and semimak as the layout?
347347
setConfig("mode", "time", {
@@ -368,6 +368,23 @@ export async function setup(challengeName: string): Promise<boolean> {
368368
setConfig("keymapMode", "static", {
369369
nosave: true,
370370
});
371+
} else if (challenge.name === "wingdings") {
372+
// Ten Words of Pain: 10-word Master mode test using the Wingdings custom font, no keymap
373+
setConfig("mode", "words", {
374+
nosave: true,
375+
});
376+
setConfig("words", 10, {
377+
nosave: true,
378+
});
379+
setConfig("difficulty", "master", {
380+
nosave: true,
381+
});
382+
setConfig("fontFamily", "Wingdings", {
383+
nosave: true,
384+
});
385+
setConfig("keymapMode", "off", {
386+
nosave: true,
387+
});
371388
}
372389
}
373390
notitext = challenge.message;
@@ -405,6 +422,7 @@ configEvent.subscribe(({ key }) => {
405422
"keymapMode",
406423
"keymapLayout",
407424
"layout",
425+
"fontFamily",
408426
].includes(key)
409427
) {
410428
clearActive();

frontend/src/ts/controllers/url-handler.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,18 @@ export async function loadChallengeFromUrl(
317317
).toLowerCase();
318318
if (getValue === "") return;
319319

320-
const result = await ChallengeController.setup(getValue);
321-
if (result) {
322-
restartTest({
323-
nosave: true,
320+
ChallengeController.setup(getValue)
321+
.then((result) => {
322+
if (result) {
323+
restartTest({
324+
nosave: true,
325+
});
326+
}
327+
})
328+
.catch((e: unknown) => {
329+
showErrorNotification("Failed to load challenge");
330+
console.error(e);
324331
});
325-
}
326332
}
327333

328334
authEvent.subscribe(async (event) => {

frontend/static/challenges/_list.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,5 +722,20 @@
722722
"display": "Feet warrior",
723723
"type": "customTime",
724724
"parameters": [3600]
725+
},
726+
{
727+
"name": "wingdings",
728+
"display": "Ten Words of Pain",
729+
"type": "other",
730+
"parameters": [],
731+
"message": "Complete a 10-word Master mode test using the Wingdings custom font. No keymap allowed. Minimum 60 WPM and 100% accuracy required.",
732+
"requirements": {
733+
"wpm": {
734+
"min": 60
735+
},
736+
"acc": {
737+
"min": 100
738+
}
739+
}
725740
}
726741
]

packages/schemas/src/challenges.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const ChallengeSchema = z
1717
"script",
1818
"accuracy",
1919
"funbox",
20+
"other",
2021
]),
2122
message: z.string().optional(),
2223
parameters: z.array(

0 commit comments

Comments
 (0)