import { VERTICALS } from "@/config/verticals" import { notFound } from "next/navigation" import { getApiUrl } from "@/lib/api-config" interface Props { params: Promise<{ vertical: string }> } export function generateStaticParams() { return VERTICALS.map((v) => ({ vertical: v.slug, })) } async function getSongs(verticalSlug: string) { try { const res = await fetch(`${getApiUrl()}/songs?vertical=${verticalSlug}`, { next: { revalidate: 60 } }) if (!res.ok) return [] const data = await res.json() return data.data || [] } catch { return [] } } export default async function SongsPage({ params }: Props) { const { vertical: verticalSlug } = await params const vertical = VERTICALS.find((v) => v.slug === verticalSlug) if (!vertical) { notFound() } const songs = await getSongs(vertical.slug) return (

{vertical.name} Songs

{songs.length === 0 ? (

No songs imported yet for {vertical.name}.

Run the data importer to populate songs.

) : (
{songs.map((song: any) => (
{song.title}
{song.original_artist && (
Cover of {song.original_artist}
)}
{song.times_played || 0} plays
))}
)}
) }