import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { ArrowLeft, Calendar, Music2 } 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" 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) return (

{tour.name}

{tour.start_date ? new Date(tour.start_date).toLocaleDateString() : "Unknown"} {tour.end_date && ` - ${new Date(tour.end_date).toLocaleDateString()}`}

Shows on {tour.name} {shows.length > 0 ? (
{[...shows] .sort((a: any, b: any) => new Date(a.date).getTime() - new Date(b.date).getTime()) .map((show: any) => (
{new Date(show.date).toLocaleDateString()}
{show.venue && ( {show.venue.name}, {show.venue.city} )}
))}
) : (

No shows found for this tour.

)}
Tour Details {tour.notes && (

{tour.notes}

)}
) }