diff options
| author | Yuval Adam <_@yuv.al> | 2025-03-07 13:55:33 +0100 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2025-03-07 13:55:33 +0100 |
| commit | b0d2625958aa1717f86d572687e1f71eb18bdc90 (patch) | |
| tree | cb115081484c606f838670ea7acea1181b6646d5 | |
| parent | d00220fdb858df5adc6f9f97df368ecf4b40fb3f (diff) | |
Remove unused reset game
| -rw-r--r-- | src/components/MorseGame.tsx | 36 |
1 files changed, 1 insertions, 35 deletions
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<MorseGameProps> = ({ onReset }) => { +const MorseGame: React.FC<MorseGameProps> = () => { // Game variables const [score, setScore] = useState(0); const [totalPlayed, setTotalPlayed] = useState(0); @@ -23,8 +23,6 @@ const MorseGame: React.FC<MorseGameProps> = ({ onReset }) => { const [wpm, setWpm] = useState(20); const [showHints, setShowHints] = useState(false); const [selectedOption, setSelectedOption] = useState<string | null>(null); - const [_correctAnswers, setCorrectAnswers] = useState<string[]>([]); - const [_incorrectAnswers, setIncorrectAnswers] = useState<string[]>([]); const actxRef = useRef<any>(null); const optionButtonsRef = useRef<Array<HTMLButtonElement | null>>([null, null, null, null]); @@ -202,38 +200,6 @@ const MorseGame: React.FC<MorseGameProps> = ({ 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]; |
