feat: artist page toggle to show all release types (default studio-only)

This commit is contained in:
Jonathan
2026-07-11 18:07:38 +02:00
parent 560fdaa4b0
commit d65230ddfb
@@ -12,7 +12,7 @@ type Release = {
state: string;
currentQualityClass: number | null;
};
type Detail = { id: string; name: string; autoMonitorFuture: boolean; releases: Release[] };
type Detail = { id: string; name: string; autoMonitorFuture: boolean; showAllTypes: boolean; releases: Release[] };
function badge(r: Release): string {
if (r.currentQualityClass !== null) return `Have (q${r.currentQualityClass})`;
@@ -43,11 +43,29 @@ export function DiscographyClient({ id }: { id: string }) {
await fetch(`/api/releases/${r.id}/search`, { method: "POST" });
refresh();
}
async function toggleShowAll() {
if (!detail) return;
await fetch(`/api/artists/${id}`, {
method: "PATCH",
headers: { "content-type": "application/json" },
body: JSON.stringify({ showAllTypes: !detail.showAllTypes }),
});
refresh();
}
if (!detail) return <p>Loading</p>;
return (
<div>
<h1>{detail.name}</h1>
<label>
<input
type="checkbox"
aria-label="show all release types"
checked={detail.showAllTypes}
onChange={toggleShowAll}
/>{" "}
Show all release types (live, compilations, singles)
</label>
<ul>
{detail.releases.map((r) => (
<li key={r.id}>