From b0d2625958aa1717f86d572687e1f71eb18bdc90 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Fri, 7 Mar 2025 13:55:33 +0100 Subject: Remove unused reset game --- src/components/MorseGame.tsx | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'src/components') diff --git a/src/components/MorseGame.tsx b/src/components/MorseGame.tsx index daa0a7d..5009044 100644 --- a/src/components/MorseGame.tsx +++ b/src/components/MorseGame.tsx @@ -14,7 +14,7 @@ interface MorseGameProps { onReset?: () => void; } -const MorseGame: React.FC = ({ onReset }) => { +const MorseGame: React.FC = () => { // Game variables const [score, setScore] = useState(0); const [totalPlayed, setTotalPlayed] = useState(0); @@ -23,8 +23,6 @@ const MorseGame: React.FC = ({ onReset }) => { const [wpm, setWpm] = useState(20); const [showHints, setShowHints] = useState(false); const [selectedOption, setSelectedOption] = useState(null); - const [_correctAnswers, setCorrectAnswers] = useState([]); - const [_incorrectAnswers, setIncorrectAnswers] = useState([]); const actxRef = useRef(null); const optionButtonsRef = useRef>([null, null, null, null]); @@ -202,38 +200,6 @@ const MorseGame: React.FC = ({ onReset }) => { return morseMap[char] || ''; }; - // Reset game to initial state - const resetGame = () => { - setScore(0); - setTotalPlayed(0); - setCurrentChar(''); - setOptions([]); - setCorrectAnswers([]); - setIncorrectAnswers([]); - - // Clear score tracker - const scoreTracker = document.getElementById('scoreTracker'); - if (scoreTracker) { - scoreTracker.innerHTML = ''; - } - - // Stop any playing audio - if (actxRef.current) { - try { - actxRef.current.close(); - actxRef.current = null; - isInitializedRef.current = false; - } catch (error) { - console.error('Error closing audio context:', error); - } - } - - // Call the parent's reset function if provided - if (onReset) { - onReset(); - } - }; - // Handle option button click const handleOptionClick = (option: string, index: number) => { const button = optionButtonsRef.current[index]; -- cgit v1.3.1