Files
loldle/components/stats-display.jsx
T
tiennm99 daf4d60bb2 refactor: migrate from vanilla JS to Next.js 16 with Tailwind CSS
- Replace vanilla HTML/CSS/JS with Next.js App Router + React components
- Game logic (champion-data, game-engine, classic-mode) moved to lib/
- UI split into modular components (game-board, champion-search, guess-grid, etc.)
- Add Tailwind CSS v4 with CSS variables for theming
- Immutable state updates, fetch deduplication, next/image for CDN images
- champions.json moved from assets/ to public/
2026-04-04 11:52:59 +07:00

26 lines
810 B
React

"use client";
/** Unlimited mode stats display */
export default function StatsDisplay({ stats }) {
if (!stats || stats.gamesPlayed === 0) return null;
const winRate = Math.round((stats.gamesWon / stats.gamesPlayed) * 100);
const items = [
{ value: stats.gamesPlayed, label: "Played" },
{ value: `${winRate}%`, label: "Win Rate" },
{ value: stats.gamesWon, label: "Won" },
];
return (
<div className="flex justify-center gap-6 py-3 mb-4">
{items.map(({ value, label }) => (
<div key={label} className="flex flex-col items-center gap-0.5">
<span className="text-xl font-bold text-[var(--color-text)]">{value}</span>
<span className="text-[0.7rem] text-[var(--color-text-muted)] uppercase">{label}</span>
</div>
))}
</div>
);
}