"use client" import { useEffect, useState, Suspense } 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, Loader2, ArrowLeft } from "lucide-react" import { Skeleton } from "@/components/ui/skeleton" import { Button } from "@/components/ui/button" interface Show { id: number slug?: string date: string venue: { id: number name: string city: string state: string } } function UpcomingShowsContent() { const [shows, setShows] = useState([]) const [loading, setLoading] = useState(true) useEffect(() => { // Fetch upcoming shows fetch(`${getApiUrl()}/shows/upcoming?limit=100`) .then(res => res.json()) .then(data => { // Already sorted ascending by backend, but ensure just in case setShows(data) }) .catch(console.error) .finally(() => setLoading(false)) }, []) if (loading) { return (
{Array.from({ length: 6 }).map((_, i) => ( ))}
) } return (

Upcoming Shows

See where the flock is headed next.

{shows.length === 0 ? (

No upcoming shows found.

Check back later for tour announcements!

) : (
{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}
))}
)}
) } function LoadingFallback() { return (
) } export default function UpcomingShowsPage() { return ( }> ) }