aboutsummaryrefslogtreecommitdiff
path: root/web/src/components/EndScreen.tsx
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2025-09-30 13:15:59 +0200
committersrdusr <trevorgray@srdusr.com>2025-09-30 13:15:59 +0200
commit18a1b361a9d6567b87c49e8bbbf0bba9ba51687f (patch)
tree4892a7d495e44b31bb51a1e24748dcdbe57629da /web/src/components/EndScreen.tsx
parent8d60c7f93407988ee0232ea90980028f299cb0f3 (diff)
downloadtyperpunk-18a1b361a9d6567b87c49e8bbbf0bba9ba51687f.tar.gz
typerpunk-18a1b361a9d6567b87c49e8bbbf0bba9ba51687f.zip
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
Diffstat (limited to 'web/src/components/EndScreen.tsx')
-rw-r--r--web/src/components/EndScreen.tsx43
1 files changed, 41 insertions, 2 deletions
diff --git a/web/src/components/EndScreen.tsx b/web/src/components/EndScreen.tsx
index 3c70e95..9b1d7ab 100644
--- a/web/src/components/EndScreen.tsx
+++ b/web/src/components/EndScreen.tsx
@@ -492,7 +492,7 @@ export const EndScreen: FC<Props> = ({ stats, wpmHistory, onPlayAgain, onMainMen
};
// --- Layout ---
return (
- <div className="end-screen" style={{ maxWidth: 900, margin: '0 auto', padding: '2rem 1rem', minHeight: '100vh', position: 'relative', display: 'flex', flexDirection: 'column', alignItems: 'center', height: '100vh', boxSizing: 'border-box', overflow: 'hidden' }}>
+ <div className="end-screen" style={{ maxWidth: 900, margin: '0 auto', minHeight: '100vh', position: 'relative', display: 'flex', flexDirection: 'column', alignItems: 'center', height: '100vh', boxSizing: 'border-box', overflow: 'hidden' }}>
{/* Logo at top, same as TypingGame */}
<div className="logo" onClick={onMainMenu}>TyperPunk</div>
{/* Main content area, all in one flex column, no fixed elements */}
@@ -507,7 +507,7 @@ export const EndScreen: FC<Props> = ({ stats, wpmHistory, onPlayAgain, onMainMen
boxSizing: 'border-box',
}}>
{/* Text */}
- <div className="end-screen-text" style={{ margin: '0 auto 1.5rem auto', fontSize: '1.25rem', lineHeight: 1.7, maxWidth: 700, width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'relative', background: 'rgba(0,0,0,0.04)', borderRadius: 6, padding: '1rem 1.5rem', textAlign: 'left', wordBreak: 'break-word', height: 'auto' }}>
+ <div className="end-screen-text" style={{ fontSize: '1.25rem', lineHeight: 1.7, maxWidth: 700, width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'relative', background: 'rgba(0,0,0,0.04)', borderRadius: 6, padding: '1rem 1.5rem', textAlign: 'left', wordBreak: 'break-word', height: 'auto' }}>
<div className="text-display" style={{ whiteSpace: 'pre-wrap', textAlign: 'left', width: '100%' }}>{renderText()}</div>
</div>
{/* Desktop: WPM | Graph | ACC */}
@@ -540,6 +540,45 @@ export const EndScreen: FC<Props> = ({ stats, wpmHistory, onPlayAgain, onMainMen
</div>
</div>
)}
+ {/* Transparent theme toggle (no class to avoid inherited styles) */}
+ <button
+ onClick={toggleTheme}
+ style={{
+ position: 'fixed',
+ top: '1rem',
+ right: '1rem',
+ background: 'transparent',
+ border: 'none',
+ boxShadow: 'none',
+ outline: 'none',
+ backdropFilter: 'none',
+ WebkitBackdropFilter: 'none',
+ appearance: 'none',
+ WebkitAppearance: 'none',
+ MozAppearance: 'none',
+ padding: 0,
+ margin: 0,
+ borderRadius: 0,
+ }}
+ >
+ {theme === Theme.Dark ? (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
+ <circle cx="12" cy="12" r="5"/>
+ <line x1="12" y1="1" x2="12" y2="3"/>
+ <line x1="12" y1="21" x2="12" y2="23"/>
+ <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
+ <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
+ <line x1="1" y1="12" x2="3" y2="12"/>
+ <line x1="21" y1="12" x2="23" y2="12"/>
+ <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
+ <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
+ </svg>
+ ) : (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
+ <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
+ </svg>
+ )}
+ </button>
{/* TIME stat below graph */}
<div className="stat-label" style={{ fontSize: '0.8rem', color: 'var(--neutral-color)', textAlign: 'center', width: '100%', marginTop: 12 }}>TIME</div>
<div className="stat-value" style={{ color: '#00ff9d', fontSize: '2.5rem', fontWeight: 700, letterSpacing: '0.05em', lineHeight: 1.1, textAlign: 'center', width: '100%' }}>{stats.time.toFixed(1)}</div>