From 18a1b361a9d6567b87c49e8bbbf0bba9ba51687f Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 30 Sep 2025 13:15:59 +0200 Subject: TUI: fixed wpm history/made UI more identical to web/ctrl-backspace behaviour/improved accuracy Web: improved category selection/fixed endscreen responsiveness inconsistency/mistake tracking/clean game memory after use/improve general UI --- web/src/components/TypingGame.tsx | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'web/src/components/TypingGame.tsx') diff --git a/web/src/components/TypingGame.tsx b/web/src/components/TypingGame.tsx index d815420..7d79c24 100644 --- a/web/src/components/TypingGame.tsx +++ b/web/src/components/TypingGame.tsx @@ -52,7 +52,7 @@ export const TypingGame: React.FC = React.memo((props: Props): JSX.Elemen const [localInput, setLocalInput] = useState(''); const inputRef = useRef(null); const [wasmAccuracy, setWasmAccuracy] = useState(100); - const [wasmMistakes, setWasmMistakes] = useState(0); + const [_wasmMistakes, setWasmMistakes] = useState(0); const gameRef = useRef(game); const isInitialized = useRef(false); const lastInputRef = useRef(''); @@ -63,7 +63,7 @@ export const TypingGame: React.FC = React.memo((props: Props): JSX.Elemen const [finalCharTimings, setFinalCharTimings] = useState>([]); // Persistent mistake tracking const [allMistakes, setAllMistakes] = useState>([]); - const [finalAllMistakes, setFinalAllMistakes] = useState>([]); + const [_finalAllMistakes, setFinalAllMistakes] = useState>([]); // Persistent keypress history tracking const [keypressHistory, setKeypressHistory] = useState>([]); const [finalKeypressHistory, setFinalKeypressHistory] = useState>([]); @@ -164,7 +164,7 @@ export const TypingGame: React.FC = React.memo((props: Props): JSX.Elemen // Track error positions for this input let isError = false; if (typeof game.get_stats_and_input === 'function') { - const [wasmInput, accuracy, mistakes] = game.get_stats_and_input(); + const [, , mistakes] = game.get_stats_and_input(); // If mistakes increased, mark as error if (mistakes > 0) isError = true; } @@ -504,7 +504,7 @@ export const TypingGame: React.FC = React.memo((props: Props): JSX.Elemen /> {attribution && ( -
+
— {attribution}
)} @@ -527,7 +527,7 @@ export const TypingGame: React.FC = React.memo((props: Props): JSX.Elemen
{/* Graph center, take all available space with margin for stats */}
-
+
{/* TIME stat below graph */}
TIME
{stats.time.toFixed(1)}
@@ -537,36 +537,37 @@ export const TypingGame: React.FC = React.memo((props: Props): JSX.Elemen {/* Mobile: Graph at top, then WPM & ACC in a row, then TIME below */} {isMobileScreen && ( <> -
+
- {/* WPM (left) */} -
+ {/* WPM (left, close to edge) */} +
WPM
{Math.round(stats.wpm)}
- {/* ACC (right) */} -
+ {/* ACC (right, close to edge) */} +
ACC
{Math.round(wasmAccuracy)}%
{/* TIME stat below WPM/ACC */} -
TIME
+
TIME
{stats.time.toFixed(1)}
)}
{/* Empty space for future game modes, matches EndScreen */}
-