'use client'; import React from 'react'; import { Award, ChevronRight, Crown, Trophy, Users } from 'lucide-react'; import { Button } from '@/ui/Button'; import { Box } from '@/ui/Box'; import { Stack } from '@/ui/Stack'; import { Text } from '@/ui/Text'; import { Heading } from '@/ui/Heading'; import { Image } from '@/ui/Image'; import { getMediaUrl } from '@/lib/utilities/media'; interface TeamLeaderboardPreviewProps { topTeams: Array<{ id: string; name: string; logoUrl?: string; category?: string; memberCount: number; totalWins: number; isRecruiting: boolean; rating?: number; performanceLevel: string; }>; onTeamClick: (id: string) => void; onViewFullLeaderboard: () => void; } export function TeamLeaderboardPreview({ topTeams, onTeamClick, onViewFullLeaderboard }: TeamLeaderboardPreviewProps) { const getMedalColor = (position: number) => { switch (position) { case 0: return '#facc15'; case 1: return '#d1d5db'; case 2: return '#d97706'; default: return '#6b7280'; } }; const getMedalBg = (position: number) => { switch (position) { case 0: return 'rgba(250, 204, 21, 0.1)'; case 1: return 'rgba(209, 213, 219, 0.1)'; case 2: return 'rgba(217, 119, 6, 0.1)'; default: return 'rgba(38, 38, 38, 0.5)'; } }; const getMedalBorder = (position: number) => { switch (position) { case 0: return 'rgba(250, 204, 21, 0.3)'; case 1: return 'rgba(209, 213, 219, 0.3)'; case 2: return 'rgba(217, 119, 6, 0.3)'; default: return 'rgba(38, 38, 38, 1)'; } }; if (topTeams.length === 0) return null; return ( {/* Header */} Top Teams Highest rated racing teams {/* Compact Leaderboard */} {topTeams.map((team, index) => ( onTeamClick(team.id)} style={{ display: 'flex', alignItems: 'center', gap: '1rem', padding: '0.75rem 1rem', width: '100%', textAlign: 'left', backgroundColor: 'transparent', border: 'none', cursor: 'pointer', borderBottom: index < topTeams.length - 1 ? '1px solid rgba(38, 38, 38, 0.5)' : 'none' }} > {/* Position */} {index < 3 ? ( ) : ( index + 1 )} {/* Team Info */} {team.name} {team.name} {team.category && ( {team.category} )} {team.memberCount} {team.totalWins} wins {team.isRecruiting && ( Recruiting )} {/* Rating */} {typeof team.rating === 'number' ? Math.round(team.rating).toLocaleString() : '—'} Rating ))} ); }