import { Card } from '@/components/ui/card';
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { Badge } from '@/components/ui/badge';
import { LeaderboardContributor } from '@/types/contributor';
import { AchievementBadge, SpecialBadge } from './AchievementBadge';
import { Trophy, TrendingUp, Calendar } from 'lucide-react';
import { formatDistanceToNow } from 'date-fns';
interface LeaderboardEntryProps {
contributor: LeaderboardContributor;
showPeriodStats?: boolean;
}
export function LeaderboardEntry({ contributor, showPeriodStats = false }: LeaderboardEntryProps) {
const periodStats = contributor.stats;
const allTimeStats = contributor.total_stats;
const totalContributions = showPeriodStats
? contributor.contribution_score
: contributor.total_score;
const getRankColor = (rank: number) => {
if (rank === 1) return 'text-yellow-500';
if (rank === 2) return 'text-gray-400';
if (rank === 3) return 'text-orange-600';
return 'text-muted-foreground';
};
const getRankIcon = (rank: number) => {
if (rank <= 3) {
return
{contributor.display_name || contributor.username}