feat(web): artist detail — category tabs, cover thumbs, album modal
Discography now has category tabs (All/Albums/Singles/EPs/Live/Comps/Other with counts, defaults to Albums), cover-art thumbnails, and clicking an album opens the AlbumModal with its tracklist. Detail GET gains ?all=true so the client filters by tab (studio-only default still governs the artists-list counts). Replaces the old flat date-sorted list + show-all toggle. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,14 +2,17 @@ import { prisma } from "@/lib/db";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { isCoreRelease } from "@/lib/release-filter";
|
||||
|
||||
export async function GET(_request: Request, { params }: { params: Promise<{ id: string }> }) {
|
||||
export async function GET(request: Request, { params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
// ?all=true returns every release type (the detail page filters client-side via tabs);
|
||||
// otherwise honour the artist's showAllTypes flag (studio-only default) as before.
|
||||
const all = new URL(request.url).searchParams.get("all") === "true";
|
||||
const artist = await prisma.watchedArtist.findUnique({
|
||||
where: { id },
|
||||
include: { releases: { orderBy: [{ firstReleaseDate: "desc" }, { album: "asc" }] } },
|
||||
});
|
||||
if (!artist) return Response.json({ error: "not found" }, { status: 404 });
|
||||
const visibleReleases = artist.showAllTypes ? artist.releases : artist.releases.filter(isCoreRelease);
|
||||
const visibleReleases = all || artist.showAllTypes ? artist.releases : artist.releases.filter(isCoreRelease);
|
||||
return Response.json({
|
||||
id: artist.id,
|
||||
mbid: artist.mbid,
|
||||
|
||||
Reference in New Issue
Block a user