import { ArtistHeader } from '@/components/ArtistHeader' import { AlbumCard } from '@/components/AlbumCard' import { SongCard } from '@/components/SongCard' import { SocialLinks } from '@/components/SocialLinks' import { SectionHeader } from '@/components/SectionHeader' interface PageProps { params: Promise<{ id: string }> } async function getArtist(id: string) { const res = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL}/api/artists/${id}`, { cache: 'no-store', }) if (!res.ok) throw new Error('Artist not found') const data = await res.json() return data.artist } async function getArtistSongs(id: string) { const res = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL}/api/artists/${id}/songs`, { cache: 'no-store', }) if (!res.ok) return [] const data = await res.json() return data.songs || [] } async function getArtistAlbums(id: string) { const res = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL}/api/artists/${id}/albums`, { cache: 'no-store', }) if (!res.ok) return [] const data = await res.json() return data.albums || [] } export default async function ArtistPage({ params }: PageProps) { const { id } = await params const [artist, songs, albums] = await Promise.all([ getArtist(id), getArtistSongs(id), getArtistAlbums(id), ]) return (
{/* Social Links */} {(artist.website || artist.twitter || artist.instagram || artist.spotify) && (
)} {/* Popular Tracks */} {songs.length > 0 && (
{songs.map((song: any) => ( ))}
)} {/* Albums */} {albums.length > 0 && (
{albums.map((album: any) => ( ))}
)} {/* Bio */} {artist.bio && (

About

{artist.bio}

)}
) }