Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Candy score saved to localStorage #1975

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/pages/advent-calendar-2024/components/games/candy.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ButtonPrimary, Text, Stack, Align } from "@telefonica/mistica";
import { useScreenSize } from "@telefonica/mistica";
import { saveGameData } from "../../utils/score-manager";
import Score from "../score";
import React, { useState, useEffect } from "react";
import blau from "../../../../img/games/blau.svg";
Expand All @@ -11,6 +12,7 @@ import vivo from "../../../../img/games/vivo.svg";
import "./candy.css";

const CandyCrush = ({ onFinish }) => {
const gameName = "candyCrush";
const { isMobile } = useScreenSize();
const width = 8;
const candyColors = [movistar, tu, vivo, blau, telefonica, o2];
Expand All @@ -27,6 +29,11 @@ const CandyCrush = ({ onFinish }) => {

const handleGameEnd = () => {
if (onFinish) onFinish();
saveGameData(
gameName,
score,
true
);
};

useEffect(() => {
Expand Down
Loading