feat(elo): add ELO rating system

- DB: elo column on user table (default 1200, added via ALTER TABLE IF NOT EXISTS)
- ELO calculated after every game save (K=32, min 100)
- Bots use their fixed ELO values; only human players' ELO changes
- AI page games save with bot name (e.g. 'Holzpferd Heinz') instead of 'Stockfish'
- User profile shows ELO badge below name
- Header shows current ELO for logged-in users (links to profile)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Michess
2026-04-15 07:32:57 +02:00
parent 157c14c11e
commit 536160bba6
10 changed files with 66 additions and 13 deletions

View File

@@ -37,6 +37,11 @@ export default function Header() {
</Link>
)}
{user?.id && typeof user.id === "number" && <NotificationPanel />}
{user?.elo != null && typeof user.id === "number" && (
<Link href={`/user/${user.name}`} className="btn btn-ghost btn-sm font-mono tabular-nums" title="Deine ELO-Wertung">
{user.elo}
</Link>
)}
<ThemeToggle />
<label tabIndex={0} htmlFor="auth-modal" className="btn btn-ghost btn-circle avatar">
<div className="w-10 rounded-full">