feat: the Wanted view becomes Collection, shaped like Lidarr: an artist catalogue first, the state sections down a left rail (M502 #5577)
release / govulncheck (push) Successful in 21s
release / web (push) Successful in 1m39s
release / go (push) Successful in 1m54s
release / integration (push) Successful in 5m33s
release / android (push) Successful in 5m40s
release / Build signed APK (releases and dev) (push) Successful in 5m56s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 25s
release / Verify release artifacts (tag releases only) (push) Skipped

The section opens on a catalogue of every artist on the list, A–Z with a
letter rail, each card showing how many of their albums are held. An artist
opens on their page: every album of theirs, held or not, with its status,
search, releases and tracks. Wanted, Missing files, Activity, Following and
Blocked sit down a left rail as the sections that show state; Held is gone,
the catalogue shows it. The section moves from /wanted to /collection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 21:14:33 -04:00
co-authored by Claude Opus 5.5
parent a4fbe44bd5
commit 358849de77
34 changed files with 994 additions and 356 deletions
@@ -107,7 +107,7 @@
{#if r.held_at}
Held again {relativeTime(r.held_at)}. The rows here clear on the next scan.
{:else if r.wanted_at}
On the <a href="/wanted/missing" class="text-accent-fg hover:underline"
On the <a href="/collection/missing" class="text-accent-fg hover:underline"
>wanted list</a
> since {relativeTime(r.wanted_at)}.
{/if}
@@ -140,7 +140,7 @@ describe('admin missing files', () => {
expect(
within(screen.getByTestId('reacquisition-state')).getByRole('link', { name: /wanted list/i }).getAttribute('href')
).toBe(
'/wanted/missing'
'/collection/missing'
);
});
+1 -1
View File
@@ -146,7 +146,7 @@
<h2 class="font-display text-2xl font-medium text-text-primary">Requests</h2>
<p class="text-text-secondary">
Approve or set aside what users have asked for. An approved album or track goes on the
<a href="/wanted" class="text-accent-fg hover:underline">wanted list</a>; an approved
<a href="/collection/wanted" class="text-accent-fg hover:underline">wanted list</a>; an approved
artist is followed, wanting what they've released and what they release next.
</p>
</header>
+58
View File
@@ -0,0 +1,58 @@
<script lang="ts">
import { createWantArtistsQuery } from '#lib/api/wanted.js';
import CollectionRail from '#lib/components/wanted/CollectionRail.svelte';
let { children } = $props<{ children: import('svelte').Snippet }>();
// The Collection (M502, #5572): what the library holds and wants, and what
// Minstrel is fetching for it. Web-only and admin-only. Shaped like Lidarr
// so a person moving from it finds their way: the catalogue of artists is
// the main section, and the sections down the left show state. The
// catalogue's first page carries every section's count; the Catalogue
// shares it, so this costs no extra request there.
const artistsStore = createWantArtistsQuery();
const counts = $derived($artistsStore.data?.pages?.[0]?.counts);
// The one line that answers "does anything need me?"
const verdict = $derived.by(() => {
if (!counts) return '';
if (counts.attention) {
return counts.attention === 1 ? '1 download needs you.' : `${counts.attention} downloads need you.`;
}
const parts = [counts.wanted === 1 ? '1 album wanted' : `${counts.wanted} albums wanted`];
if (counts.activity) parts.push(`${counts.activity} downloading`);
return parts.join(', ') + '. Nothing needs you.';
});
</script>
<div class="space-y-4">
<header class="space-y-1">
<h1 class="font-display text-2xl font-medium text-text-primary">Collection</h1>
<p class="text-sm text-text-secondary">
Every artist and album in your collection: what the library holds, and what Minstrel is
getting for it, from user requests, new releases of the artists it follows, and albums whose
files went missing. It searches your indexers on a schedule, checks each download against
MusicBrainz, and files what's right into the library. Searching and quality are set under
<a href="/admin/integrations" class="text-accent-fg hover:underline">Integrations</a>.
</p>
{#if verdict}
<p class="text-sm {counts?.attention ? 'text-text-primary' : 'text-text-secondary'}" data-testid="collection-verdict">
{verdict}
{#if counts?.attention}
<a href="/collection/activity" class="ml-1 text-accent-fg hover:underline">See Activity</a>
{/if}
</p>
{/if}
</header>
<div class="md:grid md:grid-cols-[11rem_minmax(0,1fr)] md:gap-6">
<div class="mb-4 md:mb-0">
<div class="md:sticky md:top-4">
<CollectionRail {counts} />
</div>
</div>
<div class="min-w-0">
{@render children?.()}
</div>
</div>
</div>
+8
View File
@@ -0,0 +1,8 @@
<script lang="ts">
import { pageTitle } from '#lib/branding.js';
import CatalogueGrid from '#lib/components/wanted/CatalogueGrid.svelte';
</script>
<svelte:head><title>{pageTitle('Collection')}</title></svelte:head>
<CatalogueGrid />
@@ -3,6 +3,6 @@
import DownloadList from '#lib/components/wanted/DownloadList.svelte';
</script>
<svelte:head><title>{pageTitle('Wanted · Activity')}</title></svelte:head>
<svelte:head><title>{pageTitle('Collection · Activity')}</title></svelte:head>
<DownloadList />
@@ -0,0 +1,15 @@
<script lang="ts">
import { page } from '$app/state';
import { pageTitle } from '#lib/branding.js';
import WantList from '#lib/components/wanted/WantList.svelte';
// One artist in the Collection's catalogue (#5572): every album of theirs
// on the list, held or not, with its tracks a click away.
const mbid = $derived(page.params.mbid ?? '');
</script>
<svelte:head><title>{pageTitle('Collection · Artist')}</title></svelte:head>
{#key mbid}
<WantList artist={mbid} />
{/key}
@@ -3,6 +3,6 @@
import BlockList from '#lib/components/wanted/BlockList.svelte';
</script>
<svelte:head><title>{pageTitle('Wanted · Blocked')}</title></svelte:head>
<svelte:head><title>{pageTitle('Collection · Blocked')}</title></svelte:head>
<BlockList />
@@ -3,23 +3,23 @@ import { render, screen } from '@testing-library/svelte';
import { createRawSnippet } from 'svelte';
import { mockInfiniteQuery } from '../../test-utils/query';
import { pageUrlModule } from '#test-utils/mocks/appState.js';
import type { WantCounts, WantsPage } from '#lib/api/types.js';
import type { WantArtistsPage, WantCounts } from '#lib/api/types.js';
const state = vi.hoisted(() => ({ pageUrl: new URL('http://localhost/wanted') }));
const state = vi.hoisted(() => ({ pageUrl: new URL('http://localhost/collection') }));
vi.mock('$app/state', () => pageUrlModule(state));
vi.mock('#lib/api/wanted.js', () => ({ createWantsQuery: vi.fn() }));
vi.mock('#lib/api/wanted.js', () => ({ createWantArtistsQuery: vi.fn() }));
import WantedLayout from './+layout.svelte';
import { createWantsQuery } from '#lib/api/wanted.js';
import { createWantArtistsQuery } from '#lib/api/wanted.js';
const counts: WantCounts = { wanted: 5, missing: 1, held: 9, following: 2, activity: 3, attention: 0, blocked: 4 };
const counts: WantCounts = { artists: 7, wanted: 5, missing: 1, held: 9, following: 2, activity: 3, attention: 0, blocked: 4 };
const children = createRawSnippet(() => ({ render: () => `<p data-testid="tab-body">body</p>` }));
afterEach(() => vi.clearAllMocks());
function setup(c: WantCounts = counts, path = '/wanted') {
function setup(c: WantCounts = counts, path = '/collection') {
state.pageUrl = new URL(`http://localhost${path}`);
const page: WantsPage = {
const page: WantArtistsPage = {
items: [],
total: 0,
limit: 50,
@@ -27,42 +27,47 @@ function setup(c: WantCounts = counts, path = '/wanted') {
counts: c,
library: { listed_at: null, unlisted: 0, unmatched: [] }
};
vi.mocked(createWantsQuery).mockReturnValue(
mockInfiniteQuery({ pages: [page] }) as unknown as ReturnType<typeof createWantsQuery>
vi.mocked(createWantArtistsQuery).mockReturnValue(
mockInfiniteQuery({ pages: [page] }) as unknown as ReturnType<typeof createWantArtistsQuery>
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return render(WantedLayout, { children } as any);
}
describe('/wanted layout', () => {
test('tabs are links carrying their counts, the current one marked', () => {
setup(counts, '/wanted/activity');
const nav = screen.getByRole('navigation', { name: /wanted sections/i });
describe('/collection layout', () => {
test('the sections down the left carry their counts, the current one marked', () => {
setup(counts, '/collection/activity');
const nav = screen.getByRole('navigation', { name: /collection sections/i });
const links = Array.from(nav.querySelectorAll('a')).map((a) => [a.getAttribute('href'), a.textContent?.replace(/\s+/g, ' ').trim()]);
expect(links).toEqual([
['/wanted', 'Wanted 5'],
['/wanted/activity', 'Activity 3'],
['/wanted/missing', 'Missing files 1'],
['/wanted/held', 'Held 9'],
['/wanted/following', 'Following 2'],
['/wanted/blocked', 'Blocked 4']
['/collection', 'Catalogue 7'],
['/collection/wanted', 'Wanted 5'],
['/collection/missing', 'Missing files 1'],
['/collection/activity', 'Activity 3'],
['/collection/following', 'Following 2'],
['/collection/blocked', 'Blocked 4']
]);
expect(screen.getByRole('link', { name: /activity/i })).toHaveAttribute('aria-current', 'page');
expect(screen.getByRole('link', { name: /^wanted/i })).not.toHaveAttribute('aria-current');
expect(screen.getByRole('link', { name: /^catalogue/i })).not.toHaveAttribute('aria-current');
expect(screen.getByTestId('tab-body')).toBeTruthy();
});
test('when nothing needs a person the verdict says so', () => {
setup();
expect(screen.getByTestId('wanted-verdict').textContent).toMatch(/5 albums wanted, 3 downloading\. Nothing needs you\./);
expect(screen.getByTestId('collection-verdict').textContent).toMatch(/5 albums wanted, 3 downloading\. Nothing needs you\./);
expect(screen.queryByTestId('tab-attention')).toBeNull();
});
test('downloads waiting on a person lead the page and mark Activity', () => {
setup({ ...counts, attention: 2 });
const verdict = screen.getByTestId('wanted-verdict');
const verdict = screen.getByTestId('collection-verdict');
expect(verdict.textContent).toMatch(/2 downloads need you/);
expect(screen.getByRole('link', { name: /see activity/i }).getAttribute('href')).toBe('/wanted/activity');
expect(screen.getByRole('link', { name: /see activity/i }).getAttribute('href')).toBe('/collection/activity');
expect(screen.getByTestId('tab-attention').textContent).toBe('2');
});
test("an artist's page sits under Catalogue", () => {
setup(counts, '/collection/artist/blur');
expect(screen.getByRole('link', { name: /^catalogue/i })).toHaveAttribute('aria-current', 'page');
});
});
@@ -4,7 +4,7 @@
import ReleaseProfilesCard from '#lib/components/ReleaseProfilesCard.svelte';
</script>
<svelte:head><title>{pageTitle('Wanted · Following')}</title></svelte:head>
<svelte:head><title>{pageTitle('Collection · Following')}</title></svelte:head>
<div class="space-y-6">
<FollowList />
@@ -3,6 +3,6 @@
import WantList from '#lib/components/wanted/WantList.svelte';
</script>
<svelte:head><title>{pageTitle('Wanted · Missing files')}</title></svelte:head>
<svelte:head><title>{pageTitle('Collection · Missing files')}</title></svelte:head>
<WantList list="missing" />
@@ -3,6 +3,6 @@
import WantList from '#lib/components/wanted/WantList.svelte';
</script>
<svelte:head><title>{pageTitle('Wanted')}</title></svelte:head>
<svelte:head><title>{pageTitle('Collection · Wanted')}</title></svelte:head>
<WantList list="wanted" />
-48
View File
@@ -1,48 +0,0 @@
<script lang="ts">
import { createWantsQuery } from '#lib/api/wanted.js';
import WantedTabs from '#lib/components/WantedTabs.svelte';
let { children } = $props<{ children: import('svelte').Snippet }>();
// The Wanted view (M502): what Minstrel is getting for the library, its
// downloads, and what it has set aside. Web-only and admin-only. The
// wanted query's first page carries every tab's count; the Wanted tab
// shares it, so this costs no extra request there.
const wantsStore = createWantsQuery('wanted');
const counts = $derived($wantsStore.data?.pages?.[0]?.counts);
// The one line that answers "does anything need me?"
const verdict = $derived.by(() => {
if (!counts) return '';
if (counts.attention) {
return counts.attention === 1 ? '1 download needs you.' : `${counts.attention} downloads need you.`;
}
const parts = [counts.wanted === 1 ? '1 album wanted' : `${counts.wanted} albums wanted`];
if (counts.activity) parts.push(`${counts.activity} downloading`);
return parts.join(', ') + '. Nothing needs you.';
});
</script>
<div class="space-y-4">
<header class="space-y-1">
<h1 class="font-display text-2xl font-medium text-text-primary">Wanted</h1>
<p class="text-sm text-text-secondary">
Albums Minstrel is getting: ones users requested, new releases from the artists it follows,
and albums whose files went missing. It searches your indexers on a schedule, checks each
download against MusicBrainz, and files what's right into the library. Searching and quality
are set under <a href="/admin/integrations" class="text-accent-fg hover:underline">Integrations</a>.
</p>
{#if verdict}
<p class="text-sm {counts?.attention ? 'text-text-primary' : 'text-text-secondary'}" data-testid="wanted-verdict">
{verdict}
{#if counts?.attention}
<a href="/wanted/activity" class="ml-1 text-accent-fg hover:underline">See Activity</a>
{/if}
</p>
{/if}
</header>
<WantedTabs {counts} />
{@render children?.()}
</div>
-8
View File
@@ -1,8 +0,0 @@
<script lang="ts">
import { pageTitle } from '#lib/branding.js';
import WantList from '#lib/components/wanted/WantList.svelte';
</script>
<svelte:head><title>{pageTitle('Wanted · Held')}</title></svelte:head>
<WantList list="held" />