From 6588e61674059612dc95c3216f54720b1c42f6ee Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 14 Feb 2026 00:21:30 +0900 Subject: feat(frontend): update dependencies --- frontend/app/components/Gaming/Score.tsx | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'frontend/app/components') diff --git a/frontend/app/components/Gaming/Score.tsx b/frontend/app/components/Gaming/Score.tsx index b4a415c..ee23a6c 100644 --- a/frontend/app/components/Gaming/Score.tsx +++ b/frontend/app/components/Gaming/Score.tsx @@ -6,30 +6,28 @@ type Props = { }; export default function Score({ status, score }: Props) { - const [displayScore, setDisplayScore] = useState(score); + const [randomScore, setRandomScore] = useState(null); useEffect(() => { - let intervalId = null; - - if (status === "running") { - intervalId = setInterval(() => { - const maxValue = Math.pow(10, String(score ?? 100).length) - 1; - const minValue = Math.pow(10, String(score ?? 100).length - 1); - const randomValue = - Math.floor(Math.random() * (maxValue - minValue + 1)) + minValue; - setDisplayScore(randomValue); - }, 50); - } else { - setDisplayScore(score); + if (status !== "running") { + return; } + const intervalId = setInterval(() => { + const maxValue = Math.pow(10, String(score ?? 100).length) - 1; + const minValue = Math.pow(10, String(score ?? 100).length - 1); + const randomValue = + Math.floor(Math.random() * (maxValue - minValue + 1)) + minValue; + setRandomScore(randomValue); + }, 50); + return () => { - if (intervalId) { - clearInterval(intervalId); - } + clearInterval(intervalId); }; }, [status, score]); + const displayScore = status === "running" ? randomScore : score; + return ( {displayScore} -- cgit v1.3.1