"use client" import { useEffect, useState } from "react" import { getApiUrl } from "@/lib/api-config" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import Link from "next/link" import { Calendar, MapPin } from "lucide-react" import { Skeleton } from "@/components/ui/skeleton" import { useSearchParams } from "next/navigation" interface Show { id: number slug?: string date: string venue: { id: number name: string city: string state: string } } export default function ShowsPage() { const searchParams = useSearchParams() const year = searchParams.get("year") const [shows, setShows] = useState([]) const [loading, setLoading] = useState(true) useEffect(() => { const url = `${getApiUrl()}/shows/?limit=2000${year ? `&year=${year}` : ''}` fetch(url) .then(res => res.json()) .then(data => { // Sort by date descending const sorted = data.sort((a: Show, b: Show) => new Date(b.date).getTime() - new Date(a.date).getTime() ) setShows(sorted) }) .catch(console.error) .finally(() => setLoading(false)) }, [year]) if (loading) { return (
{Array.from({ length: 12 }).map((_, i) => (
))}
) } return (

Shows

Browse the complete archive of performances.

{shows.map((show) => ( {new Date(show.date).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}
{show.venue?.name}, {show.venue?.city}, {show.venue?.state}
))}
) }