Skip to content
Merged
20 changes: 19 additions & 1 deletion frontend/src/ts/controllers/challenge-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export async function setup(challengeName: string): Promise<boolean> {
nosave: true,
});
}
} else if (challenge.type === "special") {
} else if (challenge.type === "other") {
if (challenge.name === "semimak") {
// so can you make a link that sets up 120s, 10k, punct, stop on word, and semimak as the layout?
setConfig("mode", "time", {
Expand All @@ -368,6 +368,23 @@ export async function setup(challengeName: string): Promise<boolean> {
setConfig("keymapMode", "static", {
nosave: true,
});
} else if (challenge.name === "wingdings") {
// Ten Words of Pain: 10-word Master mode test using the Wingdings custom font, no keymap
setConfig("mode", "words", {
nosave: true,
});
setConfig("words", 10, {
nosave: true,
});
setConfig("difficulty", "master", {
nosave: true,
});
setConfig("fontFamily", "Wingdings", {
nosave: true,
});
setConfig("keymapMode", "off", {
nosave: true,
});
}
}
notitext = challenge.message;
Expand Down Expand Up @@ -405,6 +422,7 @@ configEvent.subscribe(({ key }) => {
"keymapMode",
"keymapLayout",
"layout",
"fontFamily",
].includes(key)
) {
clearActive();
Expand Down
16 changes: 11 additions & 5 deletions frontend/src/ts/controllers/url-handler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,18 @@ export async function loadChallengeFromUrl(
).toLowerCase();
if (getValue === "") return;

const result = await ChallengeController.setup(getValue);
if (result) {
restartTest({
nosave: true,
ChallengeController.setup(getValue)
.then((result) => {
if (result) {
restartTest({
nosave: true,
});
}
})
.catch((e: unknown) => {
showErrorNotification("Failed to load challenge");
console.error(e);
});
}
}

authEvent.subscribe(async (event) => {
Expand Down
15 changes: 15 additions & 0 deletions frontend/static/challenges/_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -722,5 +722,20 @@
"display": "Feet warrior",
"type": "customTime",
"parameters": [3600]
},
{
"name": "wingdings",
"display": "Ten Words of Pain",
"type": "other",
"parameters": [],
"message": "Complete a 10-word Master mode test using the Wingdings custom font. No keymap allowed. Minimum 60 WPM and 100% accuracy required.",
"requirements": {
"wpm": {
"min": 60
},
"acc": {
"min": 100
}
}
}
]
1 change: 1 addition & 0 deletions packages/schemas/src/challenges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const ChallengeSchema = z
"script",
"accuracy",
"funbox",
"other",
]),
message: z.string().optional(),
parameters: z.array(
Expand Down
Loading