"use client" import { useEffect, useState, Suspense, useMemo } from "react" import { getApiUrl } from "@/lib/api-config" import { Loader2, Calendar } from "lucide-react" import { Skeleton } from "@/components/ui/skeleton" import { useSearchParams } from "next/navigation" import { Button } from "@/components/ui/button" import Link from "next/link" import { BandFilter } from "@/components/shows/band-filter" import { DateGroupedList } from "@/components/shows/date-grouped-list" interface Show { id: number slug?: string date: string youtube_link?: string vertical?: { name: string slug: string } venue: { id: number name: string city: string state: string } } function ShowsContent() { const searchParams = useSearchParams() const year = searchParams.get("year") const [shows, setShows] = useState([]) const [loading, setLoading] = useState(true) const [selectedBands, setSelectedBands] = useState([]) useEffect(() => { const url = `${getApiUrl()}/shows/?limit=2000&status=past${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]) // Filter shows locally based on selection const filteredShows = useMemo(() => { if (selectedBands.length === 0) return shows return shows.filter(show => show.vertical && selectedBands.includes(show.vertical.slug) ) }, [shows, selectedBands]) if (loading) { return (
{Array.from({ length: 12 }).map((_, i) => ( ))}
) } return (

Shows

Browse the complete archive of performances.

) } function LoadingFallback() { return (
) } export default function ShowsPage() { return ( }> ) }