Skip to content

Commit

Permalink
feat(frontend): Add easteregg to dogfood (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst committed Nov 21, 2022
1 parent 23ecafa commit 5a95d06
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions frontend/src/components/UsersLeaderboard.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { onMounted, onUnmounted } from 'vue';
import { useUsersStore } from '@/stores/users';
import { storeToRefs } from 'pinia';
import * as confetti from 'canvas-confetti';
Expand Down Expand Up @@ -30,6 +31,26 @@ const onCountClick = (e: MouseEvent) => {
},
});
};
// Small little easter egg so we can dogfood:
// If you type "taco" on the leaderboard page, an error is thrown.
let lastFourKeystrokes: string[] = [];
const recordKeystroke = (e: KeyboardEvent) => {
lastFourKeystrokes.push(e.key);
lastFourKeystrokes = lastFourKeystrokes.slice(-4);
if (lastFourKeystrokes.join('') === 'taco') {
throw new Error("We don't like Tacos!");
}
};
onMounted(() => {
window.addEventListener('keydown', recordKeystroke);
});
onUnmounted(() => {
window.removeEventListener('keydown', recordKeystroke);
});
</script>

<template>
Expand Down

0 comments on commit 5a95d06

Please sign in to comment.