import { useState } from 'react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Skeleton } from '@/components/ui/skeleton'; import { Alert, AlertDescription } from '@/components/ui/alert'; import { useContributorLeaderboard } from '@/hooks/useContributorLeaderboard'; import { LeaderboardEntry } from './LeaderboardEntry'; import { TimePeriod } from '@/types/contributor'; import { Trophy, TrendingUp, Users, AlertCircle } from 'lucide-react'; import { Badge } from '@/components/ui/badge'; export function ContributorLeaderboard() { const [timePeriod, setTimePeriod] = useState('all_time'); const [limit, setLimit] = useState(50); const { data, isLoading, error } = useContributorLeaderboard(limit, timePeriod); if (error) { return ( Failed to load contributor leaderboard. Please try again later. ); } return (
{/* Header */}
Contributor Leaderboard Celebrating our amazing contributors who make ThrillWiki possible
{data?.total_contributors.toLocaleString() || 0} Contributors
{/* Time Period Filter */}
{/* Limit Filter */}
{/* Achievement Legend */} Achievement Levels Contribution points are calculated based on approved submissions: Parks (10 pts), Rides (8 pts), Companies (5 pts), Models (5 pts), Reviews (3 pts), Photos (2 pts), Edits (1 pt)
{/* Leaderboard */} {isLoading ? (
{[...Array(10)].map((_, i) => (
))}
) : data?.contributors && data.contributors.length > 0 ? (
{data.contributors.map((contributor) => ( ))}
) : (

No Contributors Yet

Be the first to contribute to ThrillWiki!

)}
); } function AchievementInfo({ level, points, color }: { level: string; points: string; color: string }) { return (
{level}
{points} pts
); }