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
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:
@@ -76,6 +76,10 @@ export type Playlist = {
|
|||||||
refreshable: boolean;
|
refreshable: boolean;
|
||||||
seed_artist_id: string | null;
|
seed_artist_id: string | null;
|
||||||
cover_url: string; // empty string when no cover; UI renders glyph
|
cover_url: string; // empty string when no cover; UI renders glyph
|
||||||
|
// Up to six distinct albums with art, in track order; each album's art is
|
||||||
|
// /api/albums/{id}/cover. Absent when the playlist has none. A home shelf
|
||||||
|
// gives each tile an album no earlier tile shows (lib/playlists/shelf.ts).
|
||||||
|
cover_album_ids?: string[];
|
||||||
track_count: number;
|
track_count: number;
|
||||||
duration_sec: number;
|
duration_sec: number;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
rows,
|
rows,
|
||||||
item,
|
item,
|
||||||
title,
|
title,
|
||||||
|
meta,
|
||||||
ariaLabel
|
ariaLabel
|
||||||
}: {
|
}: {
|
||||||
/** One or more visual rows of items rendered inside a single shared
|
/** One or more visual rows of items rendered inside a single shared
|
||||||
@@ -20,6 +21,10 @@
|
|||||||
/** Section heading shown to the left of the arrows. Omit for an
|
/** Section heading shown to the left of the arrows. Omit for an
|
||||||
unlabeled scroller. */
|
unlabeled scroller. */
|
||||||
title?: string;
|
title?: string;
|
||||||
|
/** One line of facts every item in the section shares (e.g. "25 songs
|
||||||
|
each · refreshed today"), shown beside the title so the items need
|
||||||
|
not repeat it. */
|
||||||
|
meta?: string;
|
||||||
/** Accessible label for the section as a whole. */
|
/** Accessible label for the section as a whole. */
|
||||||
ariaLabel?: string;
|
ariaLabel?: string;
|
||||||
} = $props();
|
} = $props();
|
||||||
@@ -63,7 +68,12 @@
|
|||||||
<header class="section-header">
|
<header class="section-header">
|
||||||
{#if title}
|
{#if title}
|
||||||
<!-- Section header: Fraunces (font-display) at 24px. -->
|
<!-- Section header: Fraunces (font-display) at 24px. -->
|
||||||
|
<div class="flex min-w-0 flex-wrap items-baseline gap-x-3">
|
||||||
<h2 class="font-display text-2xl font-medium text-text-primary">{title}</h2>
|
<h2 class="font-display text-2xl font-medium text-text-primary">{title}</h2>
|
||||||
|
{#if meta}
|
||||||
|
<span class="text-sm text-text-muted">{meta}</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<span></span>
|
<span></span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -7,39 +7,67 @@
|
|||||||
import { getPlaylist, systemShuffle, refreshSystem } from '#lib/api/playlists.js';
|
import { getPlaylist, systemShuffle, refreshSystem } from '#lib/api/playlists.js';
|
||||||
import { playlistTrackToRef } from '#lib/playlists/playlistTrackToRef.js';
|
import { playlistTrackToRef } from '#lib/playlists/playlistTrackToRef.js';
|
||||||
import { systemPlaylistRefetch } from '#lib/playlists/systemRefetch.js';
|
import { systemPlaylistRefetch } from '#lib/playlists/systemRefetch.js';
|
||||||
|
import { refreshedLabel, songsLikeArtist } from '#lib/playlists/shelf.js';
|
||||||
|
import { coverUrl } from '#lib/media/covers.js';
|
||||||
|
import { dominantColorFromUrl, rgbToCssString } from '#lib/media/dominantColor.js';
|
||||||
import { errCode } from '#lib/api/errors.js';
|
import { errCode } from '#lib/api/errors.js';
|
||||||
import { qk } from '#lib/api/queries.js';
|
import { qk } from '#lib/api/queries.js';
|
||||||
import { playQueue } from '#lib/player/store.svelte.js';
|
import { playQueue } from '#lib/player/store.svelte.js';
|
||||||
import { pushToast } from '#lib/stores/toast.svelte.js';
|
import { pushToast } from '#lib/stores/toast.svelte.js';
|
||||||
|
|
||||||
let { playlist }: { playlist: Playlist } = $props();
|
let {
|
||||||
|
playlist,
|
||||||
|
shape = 'square',
|
||||||
|
covers = [],
|
||||||
|
showMeta = true
|
||||||
|
}: {
|
||||||
|
playlist: Playlist;
|
||||||
|
/** square: a cover with the title over it (library pages). wide: a home
|
||||||
|
page main mix or playlist. round: a Songs like mix, shaped like the
|
||||||
|
artists elsewhere. band: a genre mix, a colour field with a fan of
|
||||||
|
covers. */
|
||||||
|
shape?: 'square' | 'wide' | 'round' | 'band';
|
||||||
|
/** Album ids whose covers this tile shows, as the shelf assigned them
|
||||||
|
(lib/playlists/shelf.ts). Empty falls back to the playlist's collage. */
|
||||||
|
covers?: string[];
|
||||||
|
/** False when the shelf heading already says the size and refresh time
|
||||||
|
every tile shares. */
|
||||||
|
showMeta?: boolean;
|
||||||
|
} = $props();
|
||||||
|
|
||||||
const isOwn = $derived(user.value?.id === playlist.user_id);
|
const isOwn = $derived(user.value?.id === playlist.user_id);
|
||||||
// Server tells us which system playlists support by-kind refresh — no
|
// Server tells us which system playlists support by-kind refresh — no
|
||||||
// hardcoded kind list here.
|
// hardcoded kind list here.
|
||||||
const refreshable = $derived(playlist.refreshable === true);
|
const refreshable = $derived(playlist.refreshable === true);
|
||||||
|
|
||||||
// System playlists atomic-replace on rebuild, so created_at
|
|
||||||
// is the last-rotated time. Surface it so users know how fresh the
|
|
||||||
// mix is. Friendly wording, not the HistoryRow "m/h ago" style.
|
|
||||||
function refreshedLabel(iso: string): string {
|
|
||||||
const t = new Date(iso);
|
|
||||||
if (Number.isNaN(t.getTime())) return '';
|
|
||||||
const now = new Date();
|
|
||||||
const mins = Math.floor((now.getTime() - t.getTime()) / 60000);
|
|
||||||
if (mins < 5) return 'Refreshed just now';
|
|
||||||
const startOfToday = new Date(now);
|
|
||||||
startOfToday.setHours(0, 0, 0, 0);
|
|
||||||
const days = Math.floor((startOfToday.getTime() - t.getTime()) / 86400000) + 1;
|
|
||||||
if (t.getTime() >= startOfToday.getTime()) return 'Refreshed today';
|
|
||||||
if (days <= 1) return 'Refreshed yesterday';
|
|
||||||
if (days < 7) return `Refreshed ${days} days ago`;
|
|
||||||
return `Refreshed ${t.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })}`;
|
|
||||||
}
|
|
||||||
const refreshed = $derived(
|
const refreshed = $derived(
|
||||||
playlist.system_variant != null ? refreshedLabel(playlist.created_at) : ''
|
playlist.system_variant != null ? refreshedLabel(playlist.created_at) : ''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// The covers this tile shows, as the shelf assigned them. The first is the
|
||||||
|
// lead: the card's picture and the source of its colour wash.
|
||||||
|
const coverUrls = $derived(covers.map((id) => coverUrl(id)));
|
||||||
|
const lead = $derived(coverUrls[0] ?? playlist.cover_url ?? '');
|
||||||
|
|
||||||
|
// The wash behind a wide card or band is the lead cover's main colour,
|
||||||
|
// darkened so light text reads on it in either theme. Until the colour is
|
||||||
|
// known (or when there is no cover) the wash is a neutral slate.
|
||||||
|
let washRgb = $state('rgb(44 49 58)');
|
||||||
|
$effect(() => {
|
||||||
|
if (shape !== 'wide' && shape !== 'band') return;
|
||||||
|
const url = lead;
|
||||||
|
if (!url) return;
|
||||||
|
dominantColorFromUrl(url).then((rgb) => {
|
||||||
|
if (rgb && url === lead) washRgb = rgbToCssString(rgb);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const subline = $derived(
|
||||||
|
playlist.kind === 'system' && playlist.description
|
||||||
|
? playlist.description
|
||||||
|
: plural(playlist.track_count, 'track', 'tracks') + (isOwn ? '' : ` · by ${playlist.owner_username}`)
|
||||||
|
);
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
let starting = $state(false);
|
let starting = $state(false);
|
||||||
@@ -137,7 +165,7 @@
|
|||||||
|
|
||||||
<svelte:window onclick={() => { menuOpen = false; }} />
|
<svelte:window onclick={() => { menuOpen = false; }} />
|
||||||
|
|
||||||
<div class="card group relative">
|
{#snippet kebab()}
|
||||||
{#if refreshable}
|
{#if refreshable}
|
||||||
<!-- Kebab is hover/focus-revealed so the default tile state is
|
<!-- Kebab is hover/focus-revealed so the default tile state is
|
||||||
just the cover. Same pattern as CardActionCluster. -->
|
just the cover. Same pattern as CardActionCluster. -->
|
||||||
@@ -178,6 +206,99 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
{#snippet playButton(extra: string)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-label={`Play ${playlist.name}`}
|
||||||
|
onclick={onPlayClick}
|
||||||
|
disabled={starting || playlist.track_count === 0}
|
||||||
|
class="play-overlay absolute flex h-12 w-12 items-center justify-center rounded-full disabled:opacity-50 {extra}"
|
||||||
|
>
|
||||||
|
<Play size={24} strokeWidth={1.5} fill="currentColor" class="ml-0.5" />
|
||||||
|
</button>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
{#snippet leadArt(rounded: string)}
|
||||||
|
{#if lead}
|
||||||
|
<img src={lead} alt="" class="h-full w-full object-cover {rounded}" />
|
||||||
|
{:else}
|
||||||
|
<div class="flex h-full w-full items-center justify-center text-text-muted">
|
||||||
|
<span class="text-xs">No tracks yet</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
{#if shape === 'wide'}
|
||||||
|
<!-- A main mix or playlist: the lead cover on the left, the name and what
|
||||||
|
the mix is built from on a wash of the cover's own colour. Text sits
|
||||||
|
beside the art, never over it. -->
|
||||||
|
<div class="card group relative h-full w-full" data-shape="wide">
|
||||||
|
{@render kebab()}
|
||||||
|
<a
|
||||||
|
href={`/playlists/${playlist.id}`}
|
||||||
|
class="wash flex h-full w-full overflow-hidden rounded-xl text-left transition-shadow duration-150 hover:shadow-lg"
|
||||||
|
style:--wash={washRgb}
|
||||||
|
>
|
||||||
|
<div class="aspect-square h-full shrink-0 bg-surface-hover">
|
||||||
|
{@render leadArt('')}
|
||||||
|
</div>
|
||||||
|
<div class="flex min-w-0 flex-1 flex-col gap-1 p-4 pr-16">
|
||||||
|
<div class="font-display text-2xl font-medium leading-tight on-wash
|
||||||
|
[display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden">{playlist.name}</div>
|
||||||
|
<div class="text-sm on-wash-2 [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden">{subline}</div>
|
||||||
|
{#if showMeta && refreshed}
|
||||||
|
<div class="mt-auto truncate text-xs on-wash-3">{refreshed}</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{@render playButton('bottom-3 right-3')}
|
||||||
|
</div>
|
||||||
|
{:else if shape === 'round'}
|
||||||
|
<!-- A Songs like mix: a circle, the shape artists have everywhere else in
|
||||||
|
Minstrel, showing the seed artist's own album. -->
|
||||||
|
<div class="card group relative w-full" data-shape="round">
|
||||||
|
{@render kebab()}
|
||||||
|
<a href={`/playlists/${playlist.id}`} class="flex w-full flex-col items-center gap-2 rounded-md p-2 text-center">
|
||||||
|
<div class="relative aspect-square w-full overflow-hidden rounded-full bg-surface-hover transition-shadow duration-150 group-hover:shadow-lg">
|
||||||
|
{@render leadArt('')}
|
||||||
|
</div>
|
||||||
|
<div class="w-full min-w-0">
|
||||||
|
<div class="text-[11px] font-medium uppercase tracking-[0.08em] text-text-muted">Songs like</div>
|
||||||
|
<div class="truncate text-sm font-medium text-text-primary">{songsLikeArtist(playlist)}</div>
|
||||||
|
{#if showMeta}
|
||||||
|
<div class="truncate text-xs text-text-muted">{plural(playlist.track_count, 'track', 'tracks')}{refreshed ? ` · ${refreshed}` : ''}</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{@render playButton('inset-x-0 top-2 mx-auto mt-[calc(50%-1.5rem-0.5rem)]')}
|
||||||
|
</div>
|
||||||
|
{:else if shape === 'band'}
|
||||||
|
<!-- A genre mix: a field of its lead cover's colour, the genre in large
|
||||||
|
type, and a small fan of three covers. -->
|
||||||
|
<div class="card group relative h-full w-full" data-shape="band">
|
||||||
|
{@render kebab()}
|
||||||
|
<a
|
||||||
|
href={`/playlists/${playlist.id}`}
|
||||||
|
class="wash relative flex h-full w-full flex-col justify-end overflow-hidden rounded-xl p-3 text-left transition-shadow duration-150 hover:shadow-lg"
|
||||||
|
style:--wash={washRgb}
|
||||||
|
>
|
||||||
|
<div class="fan" aria-hidden="true">
|
||||||
|
{#each (coverUrls.length > 0 ? coverUrls : lead ? [lead] : []) as url, i (i)}
|
||||||
|
<img src={url} alt="" />
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
<div class="relative z-10 max-w-[55%] font-display text-xl font-medium leading-tight on-wash">{playlist.name.replace(/\s+mix$/i, '')}</div>
|
||||||
|
{#if showMeta}
|
||||||
|
<div class="relative z-10 truncate text-xs on-wash-3">{plural(playlist.track_count, 'track', 'tracks')}{refreshed ? ` · ${refreshed}` : ''}</div>
|
||||||
|
{/if}
|
||||||
|
</a>
|
||||||
|
{@render playButton('bottom-3 right-3 z-20 h-10 w-10')}
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="card group relative">
|
||||||
|
{@render kebab()}
|
||||||
<a
|
<a
|
||||||
href={`/playlists/${playlist.id}`}
|
href={`/playlists/${playlist.id}`}
|
||||||
class="group flex w-full flex-col items-start gap-2 rounded-md p-2 text-left hover:bg-surface-hover"
|
class="group flex w-full flex-col items-start gap-2 rounded-md p-2 text-left hover:bg-surface-hover"
|
||||||
@@ -238,4 +359,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Wide cards and bands sit on their lead cover's colour, darkened toward
|
||||||
|
obsidian so the light text on them clears AA in both themes. */
|
||||||
|
.wash {
|
||||||
|
background: linear-gradient(
|
||||||
|
100deg,
|
||||||
|
color-mix(in srgb, var(--wash) 62%, #0e1013) 0%,
|
||||||
|
color-mix(in srgb, var(--wash) 30%, #0e1013) 100%
|
||||||
|
);
|
||||||
|
}
|
||||||
|
.on-wash { color: var(--fs-parchment); }
|
||||||
|
.on-wash-2 { color: color-mix(in srgb, var(--fs-parchment) 82%, transparent); }
|
||||||
|
.on-wash-3 { color: color-mix(in srgb, var(--fs-parchment) 68%, transparent); }
|
||||||
|
.fan {
|
||||||
|
position: absolute;
|
||||||
|
right: 0.75rem;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.fan img {
|
||||||
|
width: 4.5rem;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 6px;
|
||||||
|
box-shadow: 0 6px 16px rgb(0 0 0 / 0.45);
|
||||||
|
margin-left: -2.25rem;
|
||||||
|
}
|
||||||
|
.fan img:nth-child(1) { transform: rotate(-8deg) translateY(4px); }
|
||||||
|
.fan img:nth-child(2) { transform: translateY(-4px); z-index: 1; }
|
||||||
|
.fan img:nth-child(3) { transform: rotate(8deg) translateY(4px); z-index: 2; }
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -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'] })
|
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', () => ({
|
vi.mock('#lib/player/store.svelte.js', () => ({
|
||||||
playQueue: vi.fn()
|
playQueue: vi.fn()
|
||||||
}));
|
}));
|
||||||
@@ -335,4 +340,56 @@ describe('PlaylistCard', () => {
|
|||||||
expect(getPlaylist).toHaveBeenCalledWith('p-1');
|
expect(getPlaylist).toHaveBeenCalledWith('p-1');
|
||||||
expect(playQueue).toHaveBeenCalled();
|
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']);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,12 +3,16 @@
|
|||||||
|
|
||||||
let {
|
let {
|
||||||
label,
|
label,
|
||||||
variant = 'pending'
|
variant = 'pending',
|
||||||
|
shape = 'square'
|
||||||
}: {
|
}: {
|
||||||
/** Card title (e.g. "For You" or "Songs like…"). */
|
/** Card title (e.g. "For You" or "Songs like…"). */
|
||||||
label: string;
|
label: string;
|
||||||
/** Drives copy + animation. */
|
/** Drives copy + animation. */
|
||||||
variant?: 'building' | 'failed' | 'pending' | 'seed-needed';
|
variant?: 'building' | 'failed' | 'pending' | 'seed-needed';
|
||||||
|
/** Matches the shelf it stands in for, so a mix arriving does not
|
||||||
|
change the shelf's shape (see PlaylistCard's shapes). */
|
||||||
|
shape?: 'square' | 'wide' | 'round';
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
const copy = $derived.by(() => {
|
const copy = $derived.by(() => {
|
||||||
@@ -30,12 +34,35 @@
|
|||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex w-full flex-col items-start gap-2 rounded-md p-2 text-left" data-testid="playlist-placeholder-card" data-variant={variant}>
|
{#if shape === 'wide'}
|
||||||
<div class={coverClasses}>
|
<div
|
||||||
|
class="flex h-full w-full overflow-hidden rounded-xl bg-surface text-left"
|
||||||
|
data-testid="playlist-placeholder-card"
|
||||||
|
data-variant={variant}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="flex aspect-square h-full shrink-0 items-center justify-center bg-surface-hover text-text-muted
|
||||||
|
{variant === 'building' || variant === 'pending' ? 'animate-pulse' : ''}"
|
||||||
|
>
|
||||||
|
<Sparkles size={40} strokeWidth={1} />
|
||||||
|
</div>
|
||||||
|
<div class="flex min-w-0 flex-1 flex-col gap-1 p-4">
|
||||||
|
<div class="truncate font-display text-2xl font-medium text-text-primary">{label}</div>
|
||||||
|
<div class="text-sm text-text-muted">{copy}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div
|
||||||
|
class="flex w-full flex-col gap-2 rounded-md p-2 {shape === 'round' ? 'items-center text-center' : 'items-start text-left'}"
|
||||||
|
data-testid="playlist-placeholder-card"
|
||||||
|
data-variant={variant}
|
||||||
|
>
|
||||||
|
<div class="{coverClasses} {shape === 'round' ? 'rounded-full' : ''}">
|
||||||
<Sparkles size={40} strokeWidth={1} />
|
<Sparkles size={40} strokeWidth={1} />
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full min-w-0">
|
<div class="w-full min-w-0">
|
||||||
<div class="truncate text-sm font-medium text-text-primary">{label}</div>
|
<div class="truncate text-sm font-medium text-text-primary">{label}</div>
|
||||||
<div class="truncate text-xs text-text-muted">{copy}</div>
|
<div class="truncate text-xs text-text-muted">{copy}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import { describe, expect, test } from 'vitest';
|
||||||
|
import type { Playlist } from '#lib/api/types.js';
|
||||||
|
import { assignShelfCovers, refreshedLabel, shelfMeta, songsLikeArtist } from './shelf.js';
|
||||||
|
|
||||||
|
function pl(over: Partial<Playlist>): Playlist {
|
||||||
|
return {
|
||||||
|
id: 'p',
|
||||||
|
user_id: 'u',
|
||||||
|
owner_username: 'me',
|
||||||
|
name: 'Mix',
|
||||||
|
description: '',
|
||||||
|
is_public: false,
|
||||||
|
kind: 'system',
|
||||||
|
system_variant: 'for_you',
|
||||||
|
refreshable: true,
|
||||||
|
seed_artist_id: null,
|
||||||
|
cover_url: '',
|
||||||
|
track_count: 100,
|
||||||
|
duration_sec: 0,
|
||||||
|
created_at: '2026-11-23T08:00:00Z',
|
||||||
|
updated_at: '2026-11-23T08:00:00Z',
|
||||||
|
...over
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('assignShelfCovers', () => {
|
||||||
|
test('each tile takes the first album no earlier tile shows', () => {
|
||||||
|
const got = assignShelfCovers(
|
||||||
|
[
|
||||||
|
pl({ cover_album_ids: ['a', 'b', 'c'] }),
|
||||||
|
pl({ cover_album_ids: ['a', 'd'] }),
|
||||||
|
pl({ cover_album_ids: ['a', 'd', 'e'] })
|
||||||
|
],
|
||||||
|
1
|
||||||
|
);
|
||||||
|
expect(got).toEqual([['a'], ['d'], ['e']]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('a band takes three unused albums', () => {
|
||||||
|
const got = assignShelfCovers(
|
||||||
|
[pl({ cover_album_ids: ['a', 'b', 'c', 'd'] }), pl({ cover_album_ids: ['b', 'c', 'e', 'f', 'g'] })],
|
||||||
|
3
|
||||||
|
);
|
||||||
|
expect(got).toEqual([['a', 'b', 'c'], ['e', 'f', 'g']]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('a tile whose albums are all taken reuses its own rather than showing nothing', () => {
|
||||||
|
const got = assignShelfCovers([pl({ cover_album_ids: ['a'] }), pl({ cover_album_ids: ['a'] })], 1);
|
||||||
|
expect(got).toEqual([['a'], ['a']]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('a playlist with no cover albums gets none', () => {
|
||||||
|
expect(assignShelfCovers([pl({})], 1)).toEqual([[]]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('shelfMeta', () => {
|
||||||
|
const now = new Date('2026-11-23T15:00:00Z');
|
||||||
|
|
||||||
|
test('equal sizes and the same refresh read as one line', () => {
|
||||||
|
const mixes = [pl({ track_count: 25 }), pl({ track_count: 25 })];
|
||||||
|
expect(shelfMeta(mixes, now)).toBe('25 songs each · refreshed today');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('sizes within a tenth of each other read as "about"', () => {
|
||||||
|
const mixes = [95, 97, 99, 100].map((n) => pl({ track_count: n }));
|
||||||
|
expect(shelfMeta(mixes, now)).toBe('About 100 songs each · refreshed today');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('sizes that differ widely are left to the tiles', () => {
|
||||||
|
const mixes = [pl({ track_count: 20 }), pl({ track_count: 100 })];
|
||||||
|
expect(shelfMeta(mixes, now)).toBe('Refreshed today');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('user playlists do not count, and a shelf of only them says nothing', () => {
|
||||||
|
const mine = pl({ kind: 'user', system_variant: null, track_count: 3, created_at: '2025-01-01T00:00:00Z' });
|
||||||
|
expect(shelfMeta([mine], now)).toBe('');
|
||||||
|
expect(shelfMeta([pl({ track_count: 50 }), mine], now)).toBe('50 songs each · refreshed today');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('different refresh days are not summarised', () => {
|
||||||
|
const mixes = [pl({}), pl({ created_at: '2026-11-20T08:00:00Z' })];
|
||||||
|
expect(shelfMeta(mixes, now)).toBe('100 songs each');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('refreshedLabel', () => {
|
||||||
|
test('yesterday and older', () => {
|
||||||
|
const now = new Date('2026-11-23T12:00:00');
|
||||||
|
expect(refreshedLabel('2026-11-22T12:00:00', now)).toBe('Refreshed yesterday');
|
||||||
|
expect(refreshedLabel('2026-11-20T12:00:00', now)).toBe('Refreshed 4 days ago');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('songsLikeArtist drops the shelf-wide prefix', () => {
|
||||||
|
expect(songsLikeArtist(pl({ name: 'Songs like Low Tide Choir' }))).toBe('Low Tide Choir');
|
||||||
|
expect(songsLikeArtist(pl({ name: 'Something else' }))).toBe('Something else');
|
||||||
|
});
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
// What a home shelf of playlist tiles shows: which album covers each tile
|
||||||
|
// gets, and the one line of facts the shelf's tiles share.
|
||||||
|
import type { Playlist } from '#lib/api/types.js';
|
||||||
|
|
||||||
|
// Each tile takes the first of its playlist's cover albums that no tile
|
||||||
|
// before it on the shelf already shows, so a shelf never repeats a cover
|
||||||
|
// while a tile still has an unused one. A tile whose albums are all taken
|
||||||
|
// reuses its own first albums rather than showing nothing. `perTile` is
|
||||||
|
// how many covers a tile shows (one for a card, three for a genre band).
|
||||||
|
export function assignShelfCovers(playlists: Playlist[], perTile: number): string[][] {
|
||||||
|
const used = new Set<string>();
|
||||||
|
return playlists.map((p) => {
|
||||||
|
const own = p.cover_album_ids ?? [];
|
||||||
|
const fresh = own.filter((id) => !used.has(id)).slice(0, perTile);
|
||||||
|
const picked = fresh.length > 0 ? fresh : own.slice(0, perTile);
|
||||||
|
for (const id of picked) used.add(id);
|
||||||
|
return picked;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// System playlists are rebuilt in place, so created_at is when the mix was
|
||||||
|
// last refreshed. Worded for a person, not as "3h ago".
|
||||||
|
export function refreshedLabel(iso: string, now: Date = new Date()): string {
|
||||||
|
const t = new Date(iso);
|
||||||
|
if (Number.isNaN(t.getTime())) return '';
|
||||||
|
const mins = Math.floor((now.getTime() - t.getTime()) / 60000);
|
||||||
|
if (mins < 5) return 'Refreshed just now';
|
||||||
|
const startOfToday = new Date(now);
|
||||||
|
startOfToday.setHours(0, 0, 0, 0);
|
||||||
|
if (t.getTime() >= startOfToday.getTime()) return 'Refreshed today';
|
||||||
|
const days = Math.floor((startOfToday.getTime() - t.getTime()) / 86400000) + 1;
|
||||||
|
if (days <= 1) return 'Refreshed yesterday';
|
||||||
|
if (days < 7) return `Refreshed ${days} days ago`;
|
||||||
|
return `Refreshed ${t.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The facts every system mix on a shelf has in common, said once beside the
|
||||||
|
// shelf's title instead of under each tile: their size when it is about the
|
||||||
|
// same, and when they were refreshed when that is the same. Empty when the
|
||||||
|
// mixes share nothing worth saying. User playlists are left out: their sizes
|
||||||
|
// and ages are their own.
|
||||||
|
export function shelfMeta(playlists: Playlist[], now: Date = new Date()): string {
|
||||||
|
const mixes = playlists.filter((p) => p.kind === 'system');
|
||||||
|
if (mixes.length === 0) return '';
|
||||||
|
const parts: string[] = [];
|
||||||
|
|
||||||
|
const counts = mixes.map((p) => p.track_count).sort((a, b) => a - b);
|
||||||
|
const lo = counts[0];
|
||||||
|
const hi = counts[counts.length - 1];
|
||||||
|
if (lo === hi) {
|
||||||
|
parts.push(`${lo} ${lo === 1 ? 'song' : 'songs'} each`);
|
||||||
|
} else if (hi - lo <= hi * 0.1) {
|
||||||
|
// Close enough to read as one size: round the middle to a friendly 5.
|
||||||
|
const mid = counts[Math.floor(counts.length / 2)];
|
||||||
|
parts.push(`about ${Math.max(5, Math.round(mid / 5) * 5)} songs each`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const labels = new Set(mixes.map((p) => refreshedLabel(p.created_at, now)));
|
||||||
|
if (labels.size === 1) {
|
||||||
|
const [label] = labels;
|
||||||
|
if (label) parts.push(label.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
const line = parts.join(' · ');
|
||||||
|
return line.charAt(0).toUpperCase() + line.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Songs like Low Tide Choir" → "Low Tide Choir": a Songs like tile labels
|
||||||
|
// the artist under its circle, so the prefix would only repeat the shelf.
|
||||||
|
export function songsLikeArtist(p: Playlist): string {
|
||||||
|
return p.name.replace(/^Songs like\s+/i, '');
|
||||||
|
}
|
||||||
+48
-12
@@ -12,6 +12,7 @@
|
|||||||
import { createPlaylistsQuery } from '#lib/api/playlists.js';
|
import { createPlaylistsQuery } from '#lib/api/playlists.js';
|
||||||
import { createSystemPlaylistsStatusQuery } from '#lib/api/me.js';
|
import { createSystemPlaylistsStatusQuery } from '#lib/api/me.js';
|
||||||
import type { Playlist } from '#lib/api/types.js';
|
import type { Playlist } from '#lib/api/types.js';
|
||||||
|
import { assignShelfCovers, shelfMeta } from '#lib/playlists/shelf.js';
|
||||||
|
|
||||||
const queryStore = createHomeQuery();
|
const queryStore = createHomeQuery();
|
||||||
const query = $derived($queryStore);
|
const query = $derived($queryStore);
|
||||||
@@ -132,6 +133,21 @@
|
|||||||
return out;
|
return out;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Each shelf gives its tiles covers no earlier tile on it shows, and says
|
||||||
|
// once, in its heading, what every mix on it shares.
|
||||||
|
const realPlaylists = $derived(
|
||||||
|
playlistsRow.flatMap((it) => (it.kind === 'real' ? [it.playlist] : []))
|
||||||
|
);
|
||||||
|
const playlistsCovers = $derived(new Map(
|
||||||
|
assignShelfCovers(realPlaylists, 1).map((c, i) => [realPlaylists[i].id, c])
|
||||||
|
));
|
||||||
|
const songsLikeCovers = $derived(new Map(
|
||||||
|
assignShelfCovers(songsLikePlaylists, 1).map((c, i) => [songsLikePlaylists[i].id, c])
|
||||||
|
));
|
||||||
|
const genreCovers = $derived(new Map(
|
||||||
|
assignShelfCovers(genreMixPlaylists, 3).map((c, i) => [genreMixPlaylists[i].id, c])
|
||||||
|
));
|
||||||
|
|
||||||
// Dedicated Songs-like row: every generated "Songs like {artist}"
|
// Dedicated Songs-like row: every generated "Songs like {artist}"
|
||||||
// mix — the best-performing surface, promoted out of the Playlists
|
// mix — the best-performing surface, promoted out of the Playlists
|
||||||
// carousel to show a wider spread. Shows a few placeholders while the
|
// carousel to show a wider spread. Shows a few placeholders while the
|
||||||
@@ -155,22 +171,27 @@
|
|||||||
<svelte:head><title>{pageTitle('Home')}</title></svelte:head>
|
<svelte:head><title>{pageTitle('Home')}</title></svelte:head>
|
||||||
|
|
||||||
<div class="space-y-8">
|
<div class="space-y-8">
|
||||||
<!-- Playlists: For-You + Songs-like + user playlists, single horizontal row -->
|
<!-- Playlists: For You, Discover, the other daily mixes, then your own playlists -->
|
||||||
<section class="space-y-3">
|
<section class="space-y-3">
|
||||||
<HorizontalScrollRow
|
<HorizontalScrollRow
|
||||||
rows={[playlistsRow]}
|
rows={[playlistsRow]}
|
||||||
title="Playlists"
|
title="Playlists"
|
||||||
|
meta={shelfMeta(realPlaylists)}
|
||||||
ariaLabel="Playlists"
|
ariaLabel="Playlists"
|
||||||
>
|
>
|
||||||
{#snippet item(rowItem: PlaylistRowItem)}
|
{#snippet item(rowItem: PlaylistRowItem)}
|
||||||
<!-- Playlists at the page anchor: largest of the carousels.
|
<!-- The page's front door: the biggest tiles on it, wide cards that
|
||||||
Sized so a typical viewport shows ~5-6 across instead
|
say what each mix is built from. Every shelf below steps down. -->
|
||||||
of cramming 8-9. -->
|
<div class="h-44 w-[26rem] max-w-[85vw]">
|
||||||
<div class="w-56">
|
|
||||||
{#if rowItem.kind === 'real'}
|
{#if rowItem.kind === 'real'}
|
||||||
<PlaylistCard playlist={rowItem.playlist} />
|
<PlaylistCard
|
||||||
|
playlist={rowItem.playlist}
|
||||||
|
shape="wide"
|
||||||
|
covers={playlistsCovers.get(rowItem.playlist.id) ?? []}
|
||||||
|
showMeta={false}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<PlaylistPlaceholderCard label={rowItem.label} variant={rowItem.variant} />
|
<PlaylistPlaceholderCard label={rowItem.label} variant={rowItem.variant} shape="wide" />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
@@ -184,14 +205,22 @@
|
|||||||
<HorizontalScrollRow
|
<HorizontalScrollRow
|
||||||
rows={[songsLikeRow]}
|
rows={[songsLikeRow]}
|
||||||
title="Songs like…"
|
title="Songs like…"
|
||||||
|
meta={shelfMeta(songsLikePlaylists)}
|
||||||
ariaLabel="Songs like"
|
ariaLabel="Songs like"
|
||||||
>
|
>
|
||||||
{#snippet item(rowItem: PlaylistRowItem)}
|
{#snippet item(rowItem: PlaylistRowItem)}
|
||||||
<div class="w-56">
|
<!-- Circles: the shape artists have everywhere else, so a Songs like
|
||||||
|
mix reads as "about this artist" before its name is read. -->
|
||||||
|
<div class="w-40">
|
||||||
{#if rowItem.kind === 'real'}
|
{#if rowItem.kind === 'real'}
|
||||||
<PlaylistCard playlist={rowItem.playlist} />
|
<PlaylistCard
|
||||||
|
playlist={rowItem.playlist}
|
||||||
|
shape="round"
|
||||||
|
covers={songsLikeCovers.get(rowItem.playlist.id) ?? []}
|
||||||
|
showMeta={false}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<PlaylistPlaceholderCard label={rowItem.label} variant={rowItem.variant} />
|
<PlaylistPlaceholderCard label={rowItem.label} variant={rowItem.variant} shape="round" />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
@@ -206,11 +235,18 @@
|
|||||||
<HorizontalScrollRow
|
<HorizontalScrollRow
|
||||||
rows={[genreMixPlaylists]}
|
rows={[genreMixPlaylists]}
|
||||||
title="Your genres"
|
title="Your genres"
|
||||||
|
meta={shelfMeta(genreMixPlaylists)}
|
||||||
ariaLabel="Your genres"
|
ariaLabel="Your genres"
|
||||||
>
|
>
|
||||||
{#snippet item(playlist: Playlist)}
|
{#snippet item(playlist: Playlist)}
|
||||||
<div class="w-56">
|
<!-- Short, wide bands: a colour field and a fan of three covers. -->
|
||||||
<PlaylistCard {playlist} />
|
<div class="h-28 w-64">
|
||||||
|
<PlaylistCard
|
||||||
|
{playlist}
|
||||||
|
shape="band"
|
||||||
|
covers={genreCovers.get(playlist.id) ?? []}
|
||||||
|
showMeta={false}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</HorizontalScrollRow>
|
</HorizontalScrollRow>
|
||||||
|
|||||||
+14
-11
@@ -142,14 +142,15 @@ describe('home Playlists section', () => {
|
|||||||
);
|
);
|
||||||
const { container } = render(Page);
|
const { container } = render(Page);
|
||||||
|
|
||||||
for (let i = 0; i < 6; i++) {
|
// The mixes live in the Songs-like row, not the Playlists carousel. Each
|
||||||
expect(screen.getByText(`Songs like ${i}`)).toBeInTheDocument();
|
// circle is labelled by its artist; its play button names the whole mix.
|
||||||
}
|
|
||||||
// The mixes live in the Songs-like row, not the Playlists carousel.
|
|
||||||
const playlistsSection = container.querySelector('[aria-label="Playlists"]') as HTMLElement;
|
|
||||||
expect(within(playlistsSection).queryByText('Songs like 0')).toBeNull();
|
|
||||||
const songsSection = container.querySelector('[aria-label="Songs like"]') as HTMLElement;
|
const songsSection = container.querySelector('[aria-label="Songs like"]') as HTMLElement;
|
||||||
expect(within(songsSection).getByText('Songs like 0')).toBeInTheDocument();
|
for (let i = 0; i < 6; i++) {
|
||||||
|
expect(within(songsSection).getByRole('button', { name: `Play Songs like ${i}` })).toBeInTheDocument();
|
||||||
|
}
|
||||||
|
expect(songsSection.querySelectorAll('[data-shape="round"]')).toHaveLength(6);
|
||||||
|
const playlistsSection = container.querySelector('[aria-label="Playlists"]') as HTMLElement;
|
||||||
|
expect(within(playlistsSection).queryByRole('button', { name: 'Play Songs like 0' })).toBeNull();
|
||||||
// No placeholders once real mixes exist.
|
// No placeholders once real mixes exist.
|
||||||
expect(within(songsSection).queryByTestId('playlist-placeholder-card')).toBeNull();
|
expect(within(songsSection).queryByTestId('playlist-placeholder-card')).toBeNull();
|
||||||
});
|
});
|
||||||
@@ -187,12 +188,14 @@ describe('home Playlists section', () => {
|
|||||||
|
|
||||||
const genres = container.querySelector('[aria-label="Your genres"]') as HTMLElement;
|
const genres = container.querySelector('[aria-label="Your genres"]') as HTMLElement;
|
||||||
expect(genres).not.toBeNull();
|
expect(genres).not.toBeNull();
|
||||||
|
// Each band shows the genre; its play button names the whole mix.
|
||||||
const names = within(genres)
|
const names = within(genres)
|
||||||
.getAllByText(/ mix$/)
|
.getAllByRole('button', { name: /^Play / })
|
||||||
.map((el) => el.textContent?.trim());
|
.map((el) => el.getAttribute('aria-label'));
|
||||||
expect(names).toEqual(['Dub mix', 'Jazz mix', 'Shoegaze mix']);
|
expect(names).toEqual(['Play Dub mix', 'Play Jazz mix', 'Play Shoegaze mix']);
|
||||||
|
expect(genres.querySelectorAll('[data-shape="band"]')).toHaveLength(3);
|
||||||
const playlistsSection = container.querySelector('[aria-label="Playlists"]') as HTMLElement;
|
const playlistsSection = container.querySelector('[aria-label="Playlists"]') as HTMLElement;
|
||||||
expect(within(playlistsSection).queryByText('Jazz mix')).toBeNull();
|
expect(within(playlistsSection).queryByRole('button', { name: 'Play Jazz mix' })).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Your genres row is absent until a genre mix exists', () => {
|
test('Your genres row is absent until a genre mix exists', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user