Skip to content

Commit 69f896c

Browse files
authored
Use veggie emojis to represent problem difficulties in PotD message (#507)
I want to give some insight into the problem difficulty but hard is just a label! Vegetable emojis seem like a fun way to handle this.
1 parent 13fd40f commit 69f896c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

workspaces/post-leetcode-potd-to-discord/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ To use:
5959
<!-- prettier-ignore-start -->
6060
<!-- The two spaces at the end of the next line are intentional and necessary for rendering a single line break. -->
6161

62-
> New LeetCode problem of the day: [1460. Make Two Arrays Equal by Reversing Subarrays](https://leetcode.com/problems/make-two-arrays-equal-by-reversing-subarrays/) (marked Easy) ✨
62+
> New LeetCode problem of the day: 🥦 [1460. Make Two Arrays Equal by Reversing Subarrays](https://leetcode.com/problems/make-two-arrays-equal-by-reversing-subarrays/) 🥦
6363
>
6464
> ##### Problem due: ⏳ in 20 hours ⏳
6565

workspaces/post-leetcode-potd-to-discord/src/getPotdMessage.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,25 @@ import { yearMonthDayToTimestampInSeconds } from "@code-chronicles/util/yearMont
66

77
import { formatTimestampForDiscord } from "./formatTimestampForDiscord.ts";
88

9+
const EMOJI_FOR_DIFFICULTY: Record<
10+
ActiveDailyCodingChallengeQuestion["question"]["difficulty"],
11+
string
12+
> = {
13+
Easy: "🥦",
14+
Medium: "🥕",
15+
Hard: "🌶️",
16+
};
17+
918
// TODO: jest tests
1019
export function getPotdMessage({
1120
date,
1221
question: { difficulty, questionFrontendId, title, titleSlug },
1322
}: ActiveDailyCodingChallengeQuestion): string {
1423
const link = `https://leetcode.com/problems/${titleSlug}/`;
24+
const emoji = EMOJI_FOR_DIFFICULTY[difficulty];
1525

1626
return dedent`
17-
New LeetCode problem of the day: [${questionFrontendId}. ${title}](${link}) (marked ${difficulty}) ✨
27+
New LeetCode problem of the day: ${emoji} [${questionFrontendId}. ${title}](${link}) ${emoji}
1828
1929
-# Problem due: ⏳ **${formatTimestampForDiscord(yearMonthDayToTimestampInSeconds(date) + SEC_IN_DAY, "R")}** ⏳
2030
`;

0 commit comments

Comments
 (0)