This commit is contained in:
30 files changed
+3776
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { ChartNoAxesColumnIncreasing, CheckCircle2, Coins, Target, Trophy } from 'lucide-react';
|
||||
import type { GameStats } from '../types';
|
||||
|
||||
export function StatsBar({ stats }: { stats: GameStats }) {
|
||||
const average = stats.gamesPlayed ? Math.round(stats.totalCoinsSelected / stats.gamesPlayed) : 0;
|
||||
const winRate = stats.gamesPlayed ? Math.round((stats.gamesWon / stats.gamesPlayed) * 100) : 0;
|
||||
|
||||
return (
|
||||
<aside className="stats-bar" aria-label="Player statistics">
|
||||
<div className="stat-primary"><Trophy size={18} /><span><small>TOTAL SCORE</small><strong>{stats.score.toLocaleString()}</strong></span></div>
|
||||
<div><ChartNoAxesColumnIncreasing size={17} /><span><small>PLAYED</small><strong>{stats.gamesPlayed}</strong></span></div>
|
||||
<div><CheckCircle2 size={17} /><span><small>WON</small><strong>{stats.gamesWon}</strong></span></div>
|
||||
<div><Target size={17} /><span><small>WIN RATE</small><strong>{winRate}%</strong></span></div>
|
||||
<div><Coins size={17} /><span><small>AVG. COINS</small><strong>{average.toLocaleString()}</strong></span></div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user