feat(web): home shelves you can tell apart at a glance
release / go (push) Successful in 1m46s
release / web (push) Failing after 1m8s
release / govulncheck (push) Successful in 23s
release / integration (push) Successful in 4m12s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 1m38s
release / android (push) Canceled after 3m3s

Each home shelf now has its own shape. Main mixes and playlists are wide
cards: the lead album's cover on a wash of its own colour, with the name
and what the mix is built from beside it rather than over the art. Songs
like mixes are circles, the shape artists already have. Genre mixes are
short bands with a fan of three covers. Shelf sizes step down from the
main mixes.

Tiles show album covers in place of the four-cover collage, and no cover
repeats along a shelf while a tile still has an unused one. The size and
refresh time every mix on a shelf shares is said once, beside the shelf's
title. Library pages keep the square card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 16:09:02 -05:00
co-authored by Claude Opus 5.5
parent ec017838a2
commit 5e7b8a7694
9 changed files with 512 additions and 51 deletions
@@ -75,6 +75,11 @@ vi.mock('#lib/api/playlists.js', () => ({
refreshSystem: vi.fn().mockResolvedValue({ playlist_id: 'p-1', track_count: 5, track_ids: ['t-1'] })
}));
vi.mock('#lib/media/dominantColor.js', () => ({
dominantColorFromUrl: vi.fn().mockResolvedValue({ r: 90, g: 40, b: 130 }),
rgbToCssString: ({ r, g, b }: { r: number; g: number; b: number }) => `rgb(${r} ${g} ${b})`
}));
vi.mock('#lib/player/store.svelte.js', () => ({
playQueue: vi.fn()
}));
@@ -335,4 +340,56 @@ describe('PlaylistCard', () => {
expect(getPlaylist).toHaveBeenCalledWith('p-1');
expect(playQueue).toHaveBeenCalled();
});
describe('home shelf shapes', () => {
const mix: Playlist = {
...base,
name: 'For You',
kind: 'system',
system_variant: 'for_you',
refreshable: true,
description: 'Built around the songs you play most',
cover_url: '/api/playlists/p-1/cover'
};
test('a wide card shows its lead album, not the collage, and says what the mix is built from', () => {
const { container } = render(PlaylistCard, { props: { playlist: mix, shape: 'wide', covers: ['al-7'] } });
expect(container.querySelector('[data-shape="wide"] img')!.getAttribute('src')).toBe('/api/albums/al-7/cover');
expect(screen.getByText('Built around the songs you play most')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Play For You' })).toBeInTheDocument();
});
test("a wide card for someone's own playlist shows its size instead", () => {
render(PlaylistCard, { props: { playlist: base, shape: 'wide' } });
expect(screen.getByText(/12\s+tracks/)).toBeInTheDocument();
});
test('a wide card takes the colour of its lead cover', async () => {
const { container } = render(PlaylistCard, { props: { playlist: mix, shape: 'wide', covers: ['al-7'] } });
const card = container.querySelector('[data-shape="wide"] a') as HTMLElement;
await waitFor(() => expect(card.style.getPropertyValue('--wash')).toBe('rgb(90 40 130)'));
});
test('the shelf heading can carry the refresh line instead of the tile', () => {
render(PlaylistCard, {
props: { playlist: { ...mix, created_at: new Date().toISOString() }, shape: 'wide', showMeta: false }
});
expect(screen.queryByText(/Refreshed/)).toBeNull();
});
test('a Songs like circle is labelled by its artist', () => {
const sl: Playlist = { ...base, name: 'Songs like Low Tide Choir', kind: 'system', system_variant: 'songs_like_artist' };
const { container } = render(PlaylistCard, { props: { playlist: sl, shape: 'round', covers: ['al-2'] } });
expect(screen.getByText('Low Tide Choir')).toBeInTheDocument();
expect(container.querySelector('[data-shape="round"] .rounded-full img')!.getAttribute('src')).toBe('/api/albums/al-2/cover');
});
test('a genre band names the genre and fans out the covers it was given', () => {
const g: Playlist = { ...base, name: 'Jazz mix', kind: 'system', system_variant: 'genre_mix' };
const { container } = render(PlaylistCard, { props: { playlist: g, shape: 'band', covers: ['a', 'b', 'c'] } });
expect(screen.getByText('Jazz')).toBeInTheDocument();
const fan = Array.from(container.querySelectorAll('.fan img')).map((i) => i.getAttribute('src'));
expect(fan).toEqual(['/api/albums/a/cover', '/api/albums/b/cover', '/api/albums/c/cover']);
});
});
});