Skip to content

Commit b63b073

Browse files
committed
chore: add motivational messages when wpm is 0
1 parent 7eeb9fd commit b63b073

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

frontend/src/ts/test/test-logic.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,34 @@ export async function finish(difficultyFailed = false): Promise<void> {
11491149
completedEvent.keyDuration = "toolong";
11501150
}
11511151

1152+
if (
1153+
completedEvent.wpm === 0 &&
1154+
!difficultyFailed &&
1155+
completedEvent.testDuration >= 5
1156+
) {
1157+
const roundedTime = Math.round(completedEvent.testDuration);
1158+
1159+
const messages = [
1160+
`Congratulations. You just wasted ${roundedTime} seconds of your life by typing nothing. Be proud of yourself.`,
1161+
`Bravo! You've managed to waste ${roundedTime} seconds and accomplish exactly zero. A true productivity icon.`,
1162+
`That was ${roundedTime} seconds of absolutely legendary idleness. History will remember this moment.`,
1163+
`Wow, ${roundedTime} seconds of typing... nothing. Bold. Mysterious. Completely useless.`,
1164+
`Thank you for those ${roundedTime} seconds of utter nothingness. The keyboard needed the break.`,
1165+
`A breathtaking display of inactivity. ${roundedTime} seconds of absolutely nothing. Powerful.`,
1166+
`You just gave ${roundedTime} seconds of your life to the void. And the void says thanks.`,
1167+
`Stunning. ${roundedTime} seconds of intense... whatever that wasn't. Keep it up, champ.`,
1168+
`Is it performance art? A protest? Or just ${roundedTime} seconds of glorious nothing? We may never know.`,
1169+
`You typed nothing for ${roundedTime} seconds. And in that moment, you became legend.`,
1170+
];
1171+
1172+
Result.showConfetti();
1173+
Notifications.add(Arrays.randomElementFromArray(messages), 0, {
1174+
customTitle: "Nice",
1175+
duration: 15,
1176+
important: true,
1177+
});
1178+
}
1179+
11521180
if (dontSave) {
11531181
void AnalyticsController.log("testCompletedInvalid");
11541182
return;

0 commit comments

Comments
 (0)