fix(web): genre fans grow with their band, and short shelves fill the row
release / go (push) Successful in 1m51s
release / web (push) Successful in 1m31s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m22s
release / android (push) Successful in 4m58s
release / Build signed APK (push) Successful in 5m6s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 27s
release / Verify release artifacts (tag releases only) (push) Skipped
release / go (push) Successful in 1m51s
release / web (push) Successful in 1m31s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m22s
release / android (push) Successful in 4m58s
release / Build signed APK (push) Successful in 5m6s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 27s
release / Verify release artifacts (tag releases only) (push) Skipped
A genre band's fan of covers is sized to the band's height (74% of it), larger than before, and may run under the genre's name again; the name sits on a dark translucent backing that keeps it readable over any cover. A shelf with fewer items than fit across the page now splits the whole width between them, so no shelf ends partway across. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,11 +27,12 @@
|
|||||||
each · refreshed today"), shown beside the title so the items need
|
each · refreshed today"), shown beside the title so the items need
|
||||||
not repeat it. */
|
not repeat it. */
|
||||||
meta?: string;
|
meta?: string;
|
||||||
/** Size items to the row instead of a fixed width: the row shows a whole
|
/** Size items to the row instead of a fixed width: the items always fill
|
||||||
number of items that fill its width, each at least `min` px wide (and,
|
the row's width, a whole number of them at a time, each at least `min`
|
||||||
when there are fewer items than fit, at most `max` px). The width is
|
px wide; a row of fewer items than fit splits the width between them.
|
||||||
set as --tile-w on the track; an item wrapper uses it as its width. */
|
The width is set as --tile-w on the track; an item wrapper uses it as
|
||||||
fit?: { min: number; max: number };
|
its width. */
|
||||||
|
fit?: { min: number };
|
||||||
/** Accessible label for the section as a whole. */
|
/** Accessible label for the section as a whole. */
|
||||||
ariaLabel?: string;
|
ariaLabel?: string;
|
||||||
} = $props();
|
} = $props();
|
||||||
@@ -81,7 +82,7 @@
|
|||||||
const BLEED = 16;
|
const BLEED = 16;
|
||||||
const itemCount = $derived(Math.max(0, ...rows.map((r) => r.length)));
|
const itemCount = $derived(Math.max(0, ...rows.map((r) => r.length)));
|
||||||
const tileWidth = $derived(
|
const tileWidth = $derived(
|
||||||
fit ? shelfTileWidth(clientWidth - BLEED, itemCount, fit.min, fit.max, GAP) : 0
|
fit ? shelfTileWidth(clientWidth - BLEED, itemCount, fit.min, GAP) : 0
|
||||||
);
|
);
|
||||||
|
|
||||||
// clientWidth follows the window, not just scrolling, so tiles resize live.
|
// clientWidth follows the window, not just scrolling, so tiles resize live.
|
||||||
|
|||||||
@@ -282,7 +282,7 @@
|
|||||||
{@render kebab()}
|
{@render kebab()}
|
||||||
<a
|
<a
|
||||||
href={`/playlists/${playlist.id}`}
|
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"
|
class="wash band relative flex h-full w-full flex-col items-start justify-end overflow-hidden rounded-xl p-3 text-left transition-shadow duration-150 hover:shadow-lg"
|
||||||
style:--wash={washRgb}
|
style:--wash={washRgb}
|
||||||
>
|
>
|
||||||
<div class="fan" aria-hidden="true">
|
<div class="fan" aria-hidden="true">
|
||||||
@@ -377,9 +377,21 @@
|
|||||||
4.5:1 on the lightest wash washTone allows (shelf.test.ts checks it). */
|
4.5:1 on the lightest wash washTone allows (shelf.test.ts checks it). */
|
||||||
.on-wash-2 { color: color-mix(in srgb, var(--fs-parchment) 90%, transparent); }
|
.on-wash-2 { color: color-mix(in srgb, var(--fs-parchment) 90%, transparent); }
|
||||||
.on-wash-3 { color: color-mix(in srgb, var(--fs-parchment) 80%, transparent); }
|
.on-wash-3 { color: color-mix(in srgb, var(--fs-parchment) 80%, transparent); }
|
||||||
/* The genre name keeps clear of the fan: the fan is three 3.75rem covers
|
/* A band sizes its fan to its own height, so the covers grow with the
|
||||||
overlapping by half (7.5rem) plus its 0.75rem inset. */
|
band. The fan may run under the genre name; the name sits on a dark,
|
||||||
.band-name { max-width: calc(100% - 8.75rem); overflow-wrap: anywhere; }
|
translucent backing that keeps it above 4.5:1 even over a white cover
|
||||||
|
(70% obsidian over white is about #565859, 5.7:1 against parchment). */
|
||||||
|
.band { container-type: size; }
|
||||||
|
.band-name {
|
||||||
|
max-width: 85%;
|
||||||
|
padding: 0.125rem 0.5rem;
|
||||||
|
margin-left: -0.25rem;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: rgb(14 16 19 / 0.7);
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
text-shadow: 0 1px 2px rgb(0 0 0 / 0.6);
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
.fan {
|
.fan {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0.75rem;
|
right: 0.75rem;
|
||||||
@@ -388,12 +400,12 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
.fan img {
|
.fan img {
|
||||||
width: 3.75rem;
|
width: 74cqh;
|
||||||
aspect-ratio: 1;
|
aspect-ratio: 1;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
box-shadow: 0 6px 16px rgb(0 0 0 / 0.45);
|
box-shadow: 0 6px 16px rgb(0 0 0 / 0.45);
|
||||||
margin-left: -1.875rem;
|
margin-left: -37cqh;
|
||||||
}
|
}
|
||||||
.fan img:first-child { margin-left: 0; }
|
.fan img:first-child { margin-left: 0; }
|
||||||
.fan img:nth-child(1) { transform: rotate(-8deg) translateY(4px); }
|
.fan img:nth-child(1) { transform: rotate(-8deg) translateY(4px); }
|
||||||
|
|||||||
@@ -134,18 +134,18 @@ describe('washTone', () => {
|
|||||||
|
|
||||||
describe('shelfTileWidth', () => {
|
describe('shelfTileWidth', () => {
|
||||||
test('a long shelf shows whole tiles that fill its width', () => {
|
test('a long shelf shows whole tiles that fill its width', () => {
|
||||||
const w = shelfTileWidth(1000, 20, 150, 200, 16);
|
const w = shelfTileWidth(1000, 20, 150, 16);
|
||||||
const cols = Math.floor((1000 + 16) / (150 + 16));
|
const cols = Math.floor((1000 + 16) / (150 + 16));
|
||||||
expect(cols * w + (cols - 1) * 16).toBeLessThanOrEqual(1000);
|
expect(cols * w + (cols - 1) * 16).toBeLessThanOrEqual(1000);
|
||||||
expect(cols * w + (cols - 1) * 16).toBeGreaterThan(1000 - cols);
|
expect(cols * w + (cols - 1) * 16).toBeGreaterThan(1000 - cols);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('a short shelf grows its tiles up to the max', () => {
|
test('a short shelf splits the whole width between its items', () => {
|
||||||
expect(shelfTileWidth(1000, 2, 150, 200, 16)).toBe(200);
|
expect(shelfTileWidth(1000, 2, 150, 16)).toBe(492);
|
||||||
expect(shelfTileWidth(400, 2, 150, 300, 16)).toBe(192);
|
expect(shelfTileWidth(400, 2, 150, 16)).toBe(192);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('a narrow window still gets one tile at the min', () => {
|
test('a narrow window still gets one tile at the min', () => {
|
||||||
expect(shelfTileWidth(100, 5, 150, 200, 16)).toBe(150);
|
expect(shelfTileWidth(100, 5, 150, 16)).toBe(150);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -114,15 +114,13 @@ function fromHsl(h: number, s: number, l: number): { r: number; g: number; b: nu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// How wide each tile on a shelf is, so the shelf shows a whole number of
|
// How wide each tile on a shelf is, so the shelf's tiles always fill its
|
||||||
// tiles that fill its width: as many columns as fit at `min` pixels, each
|
// width: as many columns as fit at `min` pixels, each grown to share the
|
||||||
// then grown to share the width. A shelf with fewer items than columns
|
// width. A shelf with fewer items than that splits the whole width between
|
||||||
// gives each item up to `max` instead, so a short shelf is not a row of
|
// the items it has, so no shelf ends partway across the page.
|
||||||
// tiny tiles in a wide window.
|
export function shelfTileWidth(width: number, count: number, min: number, gap: number): number {
|
||||||
export function shelfTileWidth(width: number, count: number, min: number, max: number, gap: number): number {
|
|
||||||
if (width <= 0) return min;
|
if (width <= 0) return min;
|
||||||
let cols = Math.max(1, Math.floor((width + gap) / (min + gap)));
|
let cols = Math.max(1, Math.floor((width + gap) / (min + gap)));
|
||||||
if (count > 0 && count < cols) cols = count;
|
if (count > 0 && count < cols) cols = count;
|
||||||
const w = (width - (cols - 1) * gap) / cols;
|
return Math.max(min, Math.floor((width - (cols - 1) * gap) / cols));
|
||||||
return Math.floor(Math.min(Math.max(w, min), count > 0 && count <= cols ? max : Infinity));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@
|
|||||||
rows={[playlistsRow]}
|
rows={[playlistsRow]}
|
||||||
title="Playlists"
|
title="Playlists"
|
||||||
meta={shelfMeta(realPlaylists)}
|
meta={shelfMeta(realPlaylists)}
|
||||||
fit={{ min: 352, max: 480 }}
|
fit={{ min: 352 }}
|
||||||
ariaLabel="Playlists"
|
ariaLabel="Playlists"
|
||||||
>
|
>
|
||||||
{#snippet item(rowItem: PlaylistRowItem)}
|
{#snippet item(rowItem: PlaylistRowItem)}
|
||||||
@@ -209,7 +209,7 @@
|
|||||||
rows={[songsLikeRow]}
|
rows={[songsLikeRow]}
|
||||||
title="Songs like…"
|
title="Songs like…"
|
||||||
meta={shelfMeta(songsLikePlaylists)}
|
meta={shelfMeta(songsLikePlaylists)}
|
||||||
fit={{ min: 144, max: 200 }}
|
fit={{ min: 144 }}
|
||||||
ariaLabel="Songs like"
|
ariaLabel="Songs like"
|
||||||
>
|
>
|
||||||
{#snippet item(rowItem: PlaylistRowItem)}
|
{#snippet item(rowItem: PlaylistRowItem)}
|
||||||
@@ -240,7 +240,7 @@
|
|||||||
rows={[genreMixPlaylists]}
|
rows={[genreMixPlaylists]}
|
||||||
title="Your genres"
|
title="Your genres"
|
||||||
meta={shelfMeta(genreMixPlaylists)}
|
meta={shelfMeta(genreMixPlaylists)}
|
||||||
fit={{ min: 240, max: 320 }}
|
fit={{ min: 240 }}
|
||||||
ariaLabel="Your genres"
|
ariaLabel="Your genres"
|
||||||
>
|
>
|
||||||
{#snippet item(playlist: Playlist)}
|
{#snippet item(playlist: Playlist)}
|
||||||
@@ -278,7 +278,7 @@
|
|||||||
<HorizontalScrollRow
|
<HorizontalScrollRow
|
||||||
rows={[data.you_might_like_albums]}
|
rows={[data.you_might_like_albums]}
|
||||||
title="You might like"
|
title="You might like"
|
||||||
fit={{ min: 144, max: 200 }}
|
fit={{ min: 144 }}
|
||||||
ariaLabel="You might like albums"
|
ariaLabel="You might like albums"
|
||||||
>
|
>
|
||||||
{#snippet item(album: import('#lib/api/types.js').AlbumRef)}
|
{#snippet item(album: import('#lib/api/types.js').AlbumRef)}
|
||||||
@@ -290,7 +290,7 @@
|
|||||||
<HorizontalScrollRow
|
<HorizontalScrollRow
|
||||||
rows={[data.you_might_like_artists]}
|
rows={[data.you_might_like_artists]}
|
||||||
title={data.you_might_like_albums.length === 0 ? 'You might like' : undefined}
|
title={data.you_might_like_albums.length === 0 ? 'You might like' : undefined}
|
||||||
fit={{ min: 128, max: 176 }}
|
fit={{ min: 128 }}
|
||||||
ariaLabel="You might like artists"
|
ariaLabel="You might like artists"
|
||||||
>
|
>
|
||||||
{#snippet item(artist: import('#lib/api/types.js').ArtistRef)}
|
{#snippet item(artist: import('#lib/api/types.js').ArtistRef)}
|
||||||
@@ -312,7 +312,7 @@
|
|||||||
<HorizontalScrollRow
|
<HorizontalScrollRow
|
||||||
rows={chunk(data.recently_added_albums, 25)}
|
rows={chunk(data.recently_added_albums, 25)}
|
||||||
title="Recently added"
|
title="Recently added"
|
||||||
fit={{ min: 176, max: 240 }}
|
fit={{ min: 176 }}
|
||||||
ariaLabel="Recently added"
|
ariaLabel="Recently added"
|
||||||
>
|
>
|
||||||
{#snippet item(album: import('#lib/api/types.js').AlbumRef)}
|
{#snippet item(album: import('#lib/api/types.js').AlbumRef)}
|
||||||
@@ -336,7 +336,7 @@
|
|||||||
<HorizontalScrollRow
|
<HorizontalScrollRow
|
||||||
rows={[data.rediscover_albums]}
|
rows={[data.rediscover_albums]}
|
||||||
title="Rediscover"
|
title="Rediscover"
|
||||||
fit={{ min: 144, max: 200 }}
|
fit={{ min: 144 }}
|
||||||
ariaLabel="Rediscover albums"
|
ariaLabel="Rediscover albums"
|
||||||
>
|
>
|
||||||
{#snippet item(album: import('#lib/api/types.js').AlbumRef)}
|
{#snippet item(album: import('#lib/api/types.js').AlbumRef)}
|
||||||
@@ -351,7 +351,7 @@
|
|||||||
<HorizontalScrollRow
|
<HorizontalScrollRow
|
||||||
rows={[data.rediscover_artists]}
|
rows={[data.rediscover_artists]}
|
||||||
title={data.rediscover_albums.length === 0 ? 'Rediscover' : undefined}
|
title={data.rediscover_albums.length === 0 ? 'Rediscover' : undefined}
|
||||||
fit={{ min: 128, max: 176 }}
|
fit={{ min: 128 }}
|
||||||
ariaLabel="Rediscover artists"
|
ariaLabel="Rediscover artists"
|
||||||
>
|
>
|
||||||
{#snippet item(artist: import('#lib/api/types.js').ArtistRef)}
|
{#snippet item(artist: import('#lib/api/types.js').ArtistRef)}
|
||||||
@@ -397,7 +397,7 @@
|
|||||||
<HorizontalScrollRow
|
<HorizontalScrollRow
|
||||||
rows={[data.last_played_artists]}
|
rows={[data.last_played_artists]}
|
||||||
title="Last played"
|
title="Last played"
|
||||||
fit={{ min: 128, max: 176 }}
|
fit={{ min: 128 }}
|
||||||
ariaLabel="Last played artists"
|
ariaLabel="Last played artists"
|
||||||
>
|
>
|
||||||
{#snippet item(artist: import('#lib/api/types.js').ArtistRef)}
|
{#snippet item(artist: import('#lib/api/types.js').ArtistRef)}
|
||||||
|
|||||||
Reference in New Issue
Block a user