Skip to content

Commit

Permalink
Added difficulty labels to lesson cards
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory711 committed Oct 15, 2023
1 parent 4c8157d commit 1c1c9a1
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions app/Components/Home/LessonPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
CARD_PADDING,
CARD_WIDTH,
calculateCardsPerRow,
difficulty,
getDifficultyColor,
} from "./Cards";

let lessonImages: ImageURISource[] = [
Expand Down Expand Up @@ -102,6 +104,28 @@ const LessonPanel = (props: any) => {
} else {
img = lessonImages[i];
}
let difficulty: difficulty;
switch (availableLessons[i]) {
case "SUDOKU_101":
case "AMEND_NOTES":
case "NAKED_SINGLE":
case "SIMPLIFY_NOTES":
difficulty = "Very Easy";
break;
case "NAKED_SET":
difficulty = "Easy";
break;
case "HIDDEN_SINGLE":
difficulty = "Intermediate";
break;
case "HIDDEN_SET":
difficulty = "Hard";
break;
default:
difficulty = "Very Hard";
break;
}
let difficultyColor: string = getDifficultyColor(difficulty);
subArray.push(
<View style={{ width: CARD_WIDTH, padding: CARD_PADDING }}>
<TouchableOpacity
Expand All @@ -116,6 +140,13 @@ const LessonPanel = (props: any) => {
<Text variant="headlineMedium" style={{ alignSelf: "center" }}>
{formatOneLessonName(availableLessons[i])}
</Text>
<Text
variant="headlineSmall"
style={{ alignSelf: "center" }}
theme={{ colors: { onSurface: difficultyColor } }}
>
{difficulty}
</Text>
<Image
source={img}
style={{
Expand Down

0 comments on commit 1c1c9a1

Please sign in to comment.