Skip to content

Commit 2cba757

Browse files
committed
chore: move ui code to result
1 parent 1f4e616 commit 2cba757

File tree

2 files changed

+24
-29
lines changed

2 files changed

+24
-29
lines changed

frontend/src/ts/test/result.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,8 +1083,31 @@ export async function update(
10831083
$("main #result #saveScreenshotButton").removeClass("hidden");
10841084
}
10851085

1086-
TestConfig.hide();
1086+
if (res.wpm === 0 && !difficultyFailed && res.testDuration >= 5) {
1087+
const roundedTime = Math.round(res.testDuration);
1088+
1089+
const messages = [
1090+
`Congratulations. You just wasted ${roundedTime} seconds of your life by typing nothing. Be proud of yourself.`,
1091+
`Bravo! You've managed to waste ${roundedTime} seconds and accomplish exactly zero. A true productivity icon.`,
1092+
`That was ${roundedTime} seconds of absolutely legendary idleness. History will remember this moment.`,
1093+
`Wow, ${roundedTime} seconds of typing... nothing. Bold. Mysterious. Completely useless.`,
1094+
`Thank you for those ${roundedTime} seconds of utter nothingness. The keyboard needed the break.`,
1095+
`A breathtaking display of inactivity. ${roundedTime} seconds of absolutely nothing. Powerful.`,
1096+
`You just gave ${roundedTime} seconds of your life to the void. And the void says thanks.`,
1097+
`Stunning. ${roundedTime} seconds of intense... whatever that wasn't. Keep it up, champ.`,
1098+
`Is it performance art? A protest? Or just ${roundedTime} seconds of glorious nothing? We may never know.`,
1099+
`You typed nothing for ${roundedTime} seconds. And in that moment, you became legend.`,
1100+
];
1101+
1102+
showConfetti();
1103+
Notifications.add(Arrays.randomElementFromArray(messages), 0, {
1104+
customTitle: "Nice",
1105+
duration: 15,
1106+
important: true,
1107+
});
1108+
}
10871109

1110+
TestConfig.hide();
10881111
Focus.set(false);
10891112

10901113
const canQuickRestart = canQuickRestartFn(

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

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

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

0 commit comments

Comments
 (0)