import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { ArrowLeft, PlayCircle, History } 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 getSong(id: string) { try { const res = await fetch(`${getApiUrl()}/songs/${id}`, { cache: 'no-store' }) if (!res.ok) return null return res.json() } catch (e) { console.error(e) return null } } export default async function SongDetailPage({ params }: { params: Promise<{ id: string }> }) { const { id } = await params const song = await getSong(id) if (!song) { notFound() } return (

{song.title}

{song.original_artist}

{song.tags && song.tags.length > 0 && (
{song.tags.map((tag: any) => ( #{tag.name} ))}
)}
Times Played
{song.times_played}
Gap (Shows)
{song.gap}
Last Played
{song.last_played ? new Date(song.last_played).toLocaleDateString() : "Never"}
Performance History {song.performances && song.performances.length > 0 ? (
{song.performances.map((perf: any) => (
{new Date(perf.show_date).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}
{perf.venue_name}, {perf.venue_city} {perf.venue_state}
{perf.notes && (

"{perf.notes}"

)}
{/* Placeholder for Rating UI */} {perf.avg_rating > 0 ? perf.avg_rating.toFixed(1) : "Unrated"}
))}
) : (

No performances recorded.

)}
) }