diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index 872734e..9c005c6 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -5,6 +5,15 @@ import { useQuery } from "@tanstack/react-query" import { getTracks, getStats } from "@/lib/api" import type { FilterParams } from "@/lib/types" +// Helper function to format Discogs genre labels (e.g., "Pop---Ballad" -> ["Pop", "Ballad"]) +function formatGenre(genre: string): { category: string; subgenre: string } { + const parts = genre.split('---') + return { + category: parts[0] || genre, + subgenre: parts[1] || '' + } +} + export default function Home() { const [filters, setFilters] = useState({}) const [page, setPage] = useState(0) @@ -79,9 +88,21 @@ export default function Home() { {/* Primary metadata */}
- - {track.classification.genre.primary} - + {(() => { + const genre = formatGenre(track.classification.genre.primary) + return ( + <> + + {genre.category} + + {genre.subgenre && ( + + {genre.subgenre} + + )} + + ) + })()} {track.classification.mood.primary} @@ -96,10 +117,25 @@ export default function Home() {
+ {/* Secondary genres */} + {track.classification.genre.secondary && track.classification.genre.secondary.length > 0 && ( +
+ Also: + {track.classification.genre.secondary.slice(0, 3).map((g, i) => { + const genre = formatGenre(g) + return ( + + {genre.category}{genre.subgenre && ` • ${genre.subgenre}`} + + ) + })} +
+ )} + {/* Secondary moods */} {track.classification.mood.secondary && track.classification.mood.secondary.length > 0 && (
- Also: + Moods: {track.classification.mood.secondary.map((mood, i) => ( {mood}