import { useState, useEffect } from 'react' import { Loader2, Fingerprint, Zap, Music2, CloudSun, Heart, Layers, Globe, Drama, User } from 'lucide-react' import { getTasteProfile, type TasteProfileResponse } from '../lib/api' const personalityIcons: Record = { zap: Zap, cloud: CloudSun, heart: Heart, layers: Layers, globe: Globe, drama: Drama, music: Music2, } const genreBarColors = [ 'bg-[#7C3AED]', 'bg-[#8B5CF6]', 'bg-[#9F6FFB]', 'bg-[#A78BFA]', 'bg-[#B49BFC]', 'bg-[#C4ABFD]', 'bg-[#D3BCFE]', 'bg-[#DDD6FE]', 'bg-[#E8DFFE]', 'bg-[#F0EAFF]', ] export default function TasteProfilePage() { const [profile, setProfile] = useState(null) const [loading, setLoading] = useState(true) useEffect(() => { getTasteProfile() .then(setProfile) .catch(() => setProfile(null)) .finally(() => setLoading(false)) }, []) if (loading) { return (
) } if (!profile) { return (

Could not load your taste profile.

) } const PersonalityIcon = personalityIcons[profile.personality.icon] || Music2 const maxGenrePercent = profile.genre_breakdown.length > 0 ? Math.max(...profile.genre_breakdown.map((g) => g.percentage)) : 100 return (
{/* Header */}

My Taste DNA

Your musical identity, decoded from {profile.track_count} tracks across {profile.playlist_count} playlists

{/* Listening Personality */}

Your Listening Personality

{profile.personality.label}

{profile.personality.description}

{/* Genre DNA */}

Genre DNA

{profile.genre_breakdown.length === 0 ? (

No genre data yet. Import playlists to see your genre breakdown.

) : (
{profile.genre_breakdown.map((genre, i) => (
{genre.name}
{genre.percentage}%
))}
)}
{/* Audio Feature Radar */}

Audio Features

Avg Tempo
{profile.audio_features.avg_tempo} BPM
{/* Top Artists */}

Artists That Define You

{profile.top_artists.length === 0 ? (

Import playlists to see your defining artists.

) : (
{profile.top_artists.map((artist) => (

{artist.name}

{artist.track_count} track{artist.track_count !== 1 ? 's' : ''} {artist.genre ? ` ยท ${artist.genre}` : ''}

))}
)}
) } function AudioMeter({ label, value }: { label: string; value: number }) { return (
{label}
0 ? '1.5rem' : '0' }} > {value > 10 && ( {value}% )}
{value <= 10 && ( {value}% )}
) }