import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Trophy, Star, Calendar, MapPin, ExternalLink } from "lucide-react" import Link from "next/link" import { getApiUrl } from "@/lib/api-config" interface TopPerformance { performance: { id: number position: number set_name: string notes?: string youtube_link?: string } song: { id: number title: string } show: { id: number date: string } venue: { id: number name: string city: string state?: string } avg_score: number rating_count: number } async function getTopPerformances(): Promise { try { const res = await fetch(`${getApiUrl()}/leaderboards/performances/top?limit=50`, { cache: 'no-store' }) if (!res.ok) return [] return res.json() } catch (e) { console.error('Failed to fetch top performances:', e) return [] } } export default async function PerformancesPage() { const performances = await getTopPerformances() return (

Top Performances

The highest-rated jams as voted by the community

{performances.length > 0 ? (
{performances.map((item, index) => (
{/* Rank */}
{index === 0 ? "🥇" : index === 1 ? "🥈" : index === 2 ? "🥉" : {index + 1}}
{/* Song & Show Info */}
{item.song.title} {item.performance.youtube_link && ( Video )}
{new Date(item.show.date).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })} {item.venue.name} {item.venue.city && ` - ${item.venue.city}`} {item.venue.state && `, ${item.venue.state}`}
{item.performance.notes && (

{item.performance.notes}

)}
{/* Rating */}
{item.avg_score.toFixed(1)}
{item.rating_count} {item.rating_count === 1 ? 'rating' : 'ratings'}
))}
) : (

No rated performances yet

Be the first to rate a performance! Browse shows and rate your favorite jams.

Browse Shows →
)}
) }