import { Metadata } from "next" import { notFound } from "next/navigation" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Separator } from "@/components/ui/separator" import Link from "next/link" interface ArtistPageProps { params: { slug: string } } async function getArtist(slug: string) { const res = await fetch(`${process.env.INTERNAL_API_URL}/artists/${slug}`, { next: { revalidate: 60 }, }) if (!res.ok) { if (res.status === 404) return null throw new Error("Failed to fetch artist") } return res.json() } export async function generateMetadata({ params }: ArtistPageProps): Promise { const data = await getArtist(params.slug) if (!data) return { title: "Artist Not Found" } return { title: `${data.artist.name} | Fediversion`, description: data.artist.bio || `Artist profile for ${data.artist.name} on Fediversion.`, } } export default async function ArtistPage({ params }: ArtistPageProps) { const data = await getArtist(params.slug) if (!data) return notFound() const { artist, covers, guest_appearances } = data return (
{/* Header */}
{artist.image_url ? ( {artist.name} ) : (
{artist.name[0]}
)}

{artist.name}

{artist.instrument && (

{artist.instrument}

)}
{artist.bio && (

{artist.bio}

)}
Covers {covers.length} Guest Appearances {guest_appearances.length}
{covers.map((song: any) => ( {song.title}

Covered by Goose

))} {covers.length === 0 && (
No known covers by this artist.
)}
{guest_appearances.map((perf: any, i: number) => (
{new Date(perf.date).toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' })}

{perf.venue} • {perf.city}

Sat in on: {perf.song_title}
))} {guest_appearances.length === 0 && (
No recorded guest appearances.
)}
) }