Skip to content

Commit

Permalink
Achievement fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aweell committed Nov 26, 2024
1 parent ba8d2e8 commit ffcc1ab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ export const set2Movies = [
},
];

const EmojiMovies = ({ movies, onFinish }) => {
const EmojiMovies = ({ set, movies, onFinish }) => {
const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0);
const [showResult, setShowResult] = useState(false);
const [isCorrect, setIsCorrect] = useState(false);
const [score, setScore] = useState(0);
const [gameOver, setGameOver] = useState(false);
const { isMobile } = useScreenSize();

const gameName = "Emoji Movies";
const gameName = `Emoji Movies${set}`;

const { emojis, answer, correctAnswer, options } =
movies[currentQuestionIndex];
Expand Down
6 changes: 4 additions & 2 deletions src/pages/advent-calendar-2024/utils/achievement-config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ export const achievementsConfig = [
icon: IconVideoCameraFilled,
check: () => {
const gameScores = JSON.parse(localStorage.getItem("gameScores")) || {};
const emojiMoviesScore = gameScores["Emoji Movies"]?.score || 0;
return emojiMoviesScore === 400;
const emojiMovies1Score = gameScores["Emoji Movies1"]?.score || 0;
const emojiMovies2Score = gameScores["Emoji Movies2"]?.score || 0;
const totalScore = emojiMovies1Score + emojiMovies2Score;
return totalScore > 800;
},

message:
Expand Down
4 changes: 2 additions & 2 deletions src/pages/advent-calendar-2024/utils/content-config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const contentByDate = {
illustration: <Illustration03 />,
illustrationDimmed: <Illustration03 disabled />,
content: ({ closeModal }) => (
<EmojiMovies movies={set1Movies} onFinish={closeModal} />
<EmojiMovies set={1} movies={set1Movies} onFinish={closeModal} />
),
title: "Emoji movie",
description:
Expand Down Expand Up @@ -227,7 +227,7 @@ const contentByDate = {
illustration: <Illustration16 />,
illustrationDimmed: <Illustration16 disabled />,
content: ({ closeModal }) => (
<EmojiMovies movies={set2Movies} onFinish={closeModal} />
<EmojiMovies set={2} movies={set2Movies} onFinish={closeModal} />
),
title: "Emoji movie",
description:
Expand Down

0 comments on commit ffcc1ab

Please sign in to comment.