import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { ArrowLeft, Calendar, MapPin, Hash } from "lucide-react" import Link from "next/link" import { notFound } from "next/navigation" import { getApiUrl } from "@/lib/api-config" import { CommentSection } from "@/components/social/comment-section" import { EntityRating } from "@/components/social/entity-rating" import { EntityReviews } from "@/components/reviews/entity-reviews" import { SocialWrapper } from "@/components/social/social-wrapper" interface ShowWithVenue { id: number slug: string date: string venue?: { name: string city?: string state?: string } } async function getTour(id: string) { try { const res = await fetch(`${getApiUrl()}/tours/${id}`, { cache: 'no-store' }) if (!res.ok) return null return res.json() } catch (e) { console.error(e) return null } } async function getTourShows(id: string) { try { const res = await fetch(`${getApiUrl()}/shows/?tour_id=${id}`, { cache: 'no-store' }) if (!res.ok) return [] return res.json() } catch (e) { console.error(e) return [] } } export default async function TourDetailPage({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params const tour = await getTour(slug) if (!tour) { notFound() } const shows = await getTourShows(tour.id) // Calculate stats const uniqueStates = [...new Set(shows.filter((s: ShowWithVenue) => s.venue?.state).map((s: ShowWithVenue) => s.venue!.state))] const uniqueCities = [...new Set(shows.filter((s: ShowWithVenue) => s.venue?.city).map((s: ShowWithVenue) => s.venue!.city))] return (
No shows found for this tour.
)}{tour.notes}