import { Box } from '@/ui/Box'; import { Card } from '@/ui/Card'; import { Text } from '@/ui/Text'; interface PerformanceMetricsProps { stats: { winRate: number; podiumRate: number; dnfRate: number; avgFinish: number; consistency: number; bestFinish: number; worstFinish: number; }; } export function PerformanceMetrics({ stats }: PerformanceMetricsProps) { const getPerformanceVariant = (value: number, type: 'rate' | 'finish' | 'consistency'): 'blue' | 'green' | 'orange' | 'purple' => { if (type === 'rate') { if (value >= 30) return 'green'; if (value >= 15) return 'orange'; return 'blue'; } if (type === 'consistency') { if (value >= 80) return 'green'; if (value >= 60) return 'orange'; return 'blue'; } return 'blue'; }; const metrics = [ { label: 'Win Rate', value: `${stats.winRate.toFixed(1)}%`, variant: getPerformanceVariant(stats.winRate, 'rate'), icon: '🏆' }, { label: 'Podium Rate', value: `${stats.podiumRate.toFixed(1)}%`, variant: getPerformanceVariant(stats.podiumRate, 'rate'), icon: '🥇' }, { label: 'DNF Rate', value: `${stats.dnfRate.toFixed(1)}%`, variant: stats.dnfRate < 10 ? 'green' : 'orange', icon: '❌' }, { label: 'Avg Finish', value: stats.avgFinish.toFixed(1), variant: 'blue' as const, icon: '📊' }, { label: 'Consistency', value: `${stats.consistency.toFixed(0)}%`, variant: getPerformanceVariant(stats.consistency, 'consistency'), icon: '🎯' }, { label: 'Best / Worst', value: `${stats.bestFinish} / ${stats.worstFinish}`, variant: 'blue' as const, icon: '📈' } ]; return ( {metrics.map((metric, index) => ( {metric.icon} {metric.label} {metric.value} ))} ); }