mirror of
https://github.com/tiennm99/loldle.git
synced 2026-05-25 21:58:38 +00:00
daf4d60bb2
- 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/
26 lines
810 B
React
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>
|
|
);
|
|
}
|