import { notFound } from "next/navigation" import { VERTICALS } from "@/config/verticals" import { getApiUrl } from "@/lib/api-config" import Link from "next/link" import { Calendar, MapPin, Music, Trophy, Video, Ticket, Building, ChevronRight } from "lucide-react" import { Card, CardContent } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { VideoGallery } from "@/components/videos/video-gallery" import { Show, Song, PaginatedResponse } from "@/types/models" interface Props { params: Promise<{ vertical: string }> } export function generateStaticParams() { return VERTICALS.map((v) => ({ vertical: v.slug, })) } async function getRecentShows(verticalSlug: string): Promise { try { const res = await fetch(`${getApiUrl()}/shows/?vertical_slugs=${verticalSlug}&limit=8&status=past`, { next: { revalidate: 60 } }) if (!res.ok) return [] const data: PaginatedResponse = await res.json() return data.data || [] } catch { return [] } } async function getTopSongs(verticalSlug: string): Promise { try { const res = await fetch(`${getApiUrl()}/songs/?vertical=${verticalSlug}&limit=5&sort=times_played`, { next: { revalidate: 60 } }) if (!res.ok) return [] const data: PaginatedResponse = await res.json() return data.data || [] } catch { return [] } } export default async function VerticalPage({ params }: Props) { const { vertical: verticalSlug } = await params const vertical = VERTICALS.find((v) => v.slug === verticalSlug) if (!vertical) { notFound() } const [recentShows, topSongs] = await Promise.all([ getRecentShows(verticalSlug), getTopSongs(verticalSlug) ]) const navCards = [ { href: `/${verticalSlug}/shows`, icon: Calendar, title: "Shows", desc: "Browse the complete archive" }, { href: `/${verticalSlug}/venues`, icon: Building, title: "Venues", desc: "Find your favorite spots" }, { href: `/${verticalSlug}/songs`, icon: Music, title: "Songs", desc: "Explore the catalog" }, { href: `/${verticalSlug}/performances`, icon: Trophy, title: "Top Performances", desc: "Highest rated jams" }, { href: `/leaderboards?band=${verticalSlug}`, icon: Trophy, title: "Leaderboards", desc: "Top rated everything" }, { href: `/${verticalSlug}/tours`, icon: Ticket, title: "Tours", desc: "Browse by tour" }, { href: `/videos?band=${verticalSlug}`, icon: Video, title: "Videos", desc: "Watch full shows and songs" }, ] return (
{/* Hero Section */}

{vertical.name}

A comprehensive community-driven archive for {vertical.name} history.
Discover shows, share ratings, and explore the music together.

{/* Recent Shows */} {recentShows.length > 0 && (

Recent Shows

View all shows
{recentShows.slice(0, 8).map((show) => (
{new Date(show.date).toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' })}
{show.venue?.name || "Unknown Venue"}
{show.venue?.city}, {show.venue?.state || show.venue?.country}
{/* Tour is not in strict Show model yet, omitting for strictness or need to add to model */} {/* {show.tour?.name && (
{show.tour.name}
)} */}
))}
)} {/* Most Played Songs */} {topSongs.length > 0 && (

Most Played Songs

View all songs
{topSongs.slice(0, 5).map((song, index) => (
{index + 1}
{song.title}
{song.times_played || 0} performances
))}
)} {/* Videos Section */}
{/* Navigation Cards */}

Explore

{navCards.map((card) => (

{card.title}

{card.desc}

))}
) }