Add user stats feature with API and modal integration

Introduced an endpoint to fetch user stats and integrated it with a new StatsModal component in the frontend. Users can now view game statistics, including played games, wins, losses, and win rates, accessible from the user menu.
This commit is contained in:
2026-02-06 13:14:27 +01:00
parent bfb1df8e59
commit 59e224b4ca
6 changed files with 193 additions and 8 deletions
+15 -6
View File
@@ -8,19 +8,16 @@ export default function TopBar({
setUserMenuOpen,
openPwModal,
openDesignModal,
openStatsModal,
doLogout,
onOpenNewGame,
}) {
const displayName = me
? ((me.display_name || "").trim() || me.email)
: "";
const displayName = me ? ((me.display_name || "").trim() || me.email) : "";
return (
<div style={styles.topBar}>
<div>
<div style={{ fontWeight: 900, color: stylesTokens.textGold }}>
Notizbogen
</div>
<div style={{ fontWeight: 900, color: stylesTokens.textGold }}>Notizbogen</div>
<div style={{ fontSize: 12, opacity: 0.8, color: stylesTokens.textDim }}>
{displayName}
</div>
@@ -52,6 +49,18 @@ export default function TopBar({
{me?.email || ""}
</div>
<button
onClick={() => {
setUserMenuOpen(false);
openStatsModal?.();
}}
style={styles.userDropdownItem}
>
Statistik
</button>
<div style={styles.userDropdownDivider} />
<button onClick={openPwModal} style={styles.userDropdownItem}>
Passwort setzen
</button>