import type { GameStats } from '@wordle/shared'; interface Screen3ResultsProps { won: boolean; attemptCount: number; revealedWord: string | null; stats: GameStats; onPlayAgain?: () => void; // Story 1.3 } function Histogram({ stats }: { stats: GameStats }) { if (stats.gamesPlayed === 0) return

No games yet.

; const maxCount = Math.max(...stats.histogram, 1); return (
{stats.histogram.map((count, idx) => { const label = idx < 6 ? `${idx + 1}` : 'X'; const pct = (count / maxCount) * 100; return (
{label}
0 ? '#6aaa64' : '#d3d6da', width: `${Math.max(pct, count > 0 ? 5 : 0)}%`, minWidth: count > 0 ? '12px' : '4px', borderRadius: '2px' }} /> {count}
); })}
); } export function Screen3Results({ won, attemptCount, revealedWord, stats, onPlayAgain }: Screen3ResultsProps) { return (

{won ? '🎉 Congratulations!' : 'Better luck next time'}

{won ? (

Solved in {attemptCount} {attemptCount === 1 ? 'attempt' : 'attempts'}

) : ( revealedWord &&

The word was: {revealedWord.toUpperCase()}

)}

Statistics

{stats.gamesPlayed}
Played
{stats.gamesPlayed > 0 ? Math.round((stats.wins / stats.gamesPlayed) * 100) : 0}%
Win Rate
{stats.currentStreak}
Streak
{stats.maxStreak}
Max Streak
{onPlayAgain && ( )}
); }