From 1b20061e3310213929be81553fbde89026b08d39 Mon Sep 17 00:00:00 2001 From: Barry Prendergast Date: Sun, 25 Oct 2026 18:30:21 +0100 Subject: [PATCH] One column below 400px Two columns at the narrowest phone widths made the artwork and text too small. Below 400px each playlist now gets the full width. - The artwork request size follows: a full-width card asks for 100vw (CARD_IMAGE_SIZES, also used for the preload of the first image). - Descriptions are shown again in the single column. They stay hidden only in the tight two-column range of 400-480px. Co-Authored-By: Claude Sonnet 5.5 --- public/css/app.css | 12 ++++++++++-- public/js/constants.js | 2 +- test/http.test.js | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/public/css/app.css b/public/css/app.css index a74ede2..570e4f3 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -512,7 +512,7 @@ main:focus { .grid { display: grid; - /* Never fewer than two columns, so phones still show off the artwork. + /* Two columns at the narrowest, so most phones still show off the artwork. CARD_IMAGE_SIZES in js/constants.js mirrors these widths. */ grid-template-columns: repeat(auto-fill, minmax(min(13.5rem, calc((100% - var(--gap)) / 2)), 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem) var(--gap); @@ -521,6 +521,13 @@ main:focus { list-style: none; } +/* Below 400px two columns get too small to read, so each playlist gets the full width. */ +@media (max-width: 24.99rem) { + .grid { + grid-template-columns: 1fr; + } +} + .card { position: relative; display: flex; @@ -669,7 +676,8 @@ main:focus { display: none; } -@media (max-width: 30rem) { +/* Only the two-column phone layout (400-480px) is too tight for descriptions. */ +@media (min-width: 25rem) and (max-width: 30rem) { .card-description { display: none; } diff --git a/public/js/constants.js b/public/js/constants.js index 3621e24..e5c6bec 100644 --- a/public/js/constants.js +++ b/public/js/constants.js @@ -6,7 +6,7 @@ export const CACHE_KEY = 'selections:v1'; export const CACHE_ETAG_KEY = 'selections:v1:etag'; /** Approximate rendered width of a grid card's artwork; mirrors the grid in app.css. */ -export const CARD_IMAGE_SIZES = '(min-width: 80rem) 14rem, (min-width: 40rem) 30vw, 50vw'; +export const CARD_IMAGE_SIZES = '(min-width: 80rem) 14rem, (min-width: 40rem) 30vw, (min-width: 25rem) 50vw, 100vw'; /** Cards in the first rows load eagerly; the rest are lazy-loaded as you scroll. */ export const EAGER_CARD_COUNT = 6; diff --git a/test/http.test.js b/test/http.test.js index 5102672..7a7bbc9 100644 --- a/test/http.test.js +++ b/test/http.test.js @@ -129,6 +129,8 @@ describe('HTTP API', () => { const html = await (await fetch(`${ctx.base}/`)).text(); assert.match(html, /rel="preload" as="image" imagesrcset="https:\/\/resources\.tidal\.com\/images\/1\/320x320\.jpg 320w"/); assert.match(html, /rel="modulepreload" href="\/static\/dev\/js\/main\.js"/); + // The artwork is full width in the single-column phone layout. + assert.match(html, /imagesizes="[^"]*\(min-width: 25rem\) 50vw, 100vw"/); // Searches and deep links show different first cards, so no preload then. assert.doesNotMatch(await (await fetch(`${ctx.base}/?q=rock`)).text(), /as="image"/); });