From c0778dc18c353e81bb6e6898943d20d4c4329885 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Wed, 5 Mar 2025 13:28:50 +0100 Subject: Fix h1 click --- src/base.css | 2 +- src/main.tsx | 1 - src/pages/HomePage.tsx | 147 +++++++++++++++++++++++++++++-------------------- src/styles.css | 42 +++++++++----- 4 files changed, 116 insertions(+), 76 deletions(-) diff --git a/src/base.css b/src/base.css index d5afb78..dc8d1f0 100644 --- a/src/base.css +++ b/src/base.css @@ -180,4 +180,4 @@ button:hover::after { .container { padding: 15px 10px; } -} +} \ No newline at end of file diff --git a/src/main.tsx b/src/main.tsx index bef5202..4aff025 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,6 +1,5 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' -import './index.css' import App from './App.tsx' createRoot(document.getElementById('root')!).render( diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index 5892c8c..7b726a6 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -203,83 +203,110 @@ const HomePage = () => { return morseMap[char] || ''; }; + // Reset game to initial state + const resetGame = () => { + setGameStarted(false); + setScore(0); + setTotalPlayed(0); + setCurrentChar(''); + setOptions([]); + + // 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; + } catch (error) { + console.error('Error closing audio context:', error); + } + } + }; + return (
Learn Morse code the fun way!
- -Learn Morse code the fun way!
+ +