Give the empty-home playlist grid the full pane height instead of a clipped 16:9 box

This commit is contained in:
Jonathan Sykes
2026-08-16 08:52:18 +00:00
parent 4fd68ae88e
commit 5a9304780a
2 changed files with 37 additions and 1 deletions

View File

@@ -1995,8 +1995,10 @@ function renderHomePlaylists() {
wrap.classList.toggle('hidden', !lists.length);
hero.classList.toggle('hidden', !!lists.length);
// The hero is centered art; the grid wants the full box, so the placeholder
// switches from centering to stretching (and tightens its padding).
// switches from centering to stretching (and tightens its padding), and the
// stage drops its 16:9 lock so the grid gets the pane's real height.
if (els.placeholder) els.placeholder.classList.toggle('showing-playlists', !!lists.length);
if (els.playerPane) els.playerPane.classList.toggle('home-playlists', !!lists.length);
if (!lists.length) { grid.innerHTML = ''; return; }
grid.innerHTML = '';
@@ -2024,6 +2026,20 @@ function renderHomePlaylists() {
});
grid.appendChild(card);
}
// Measure after layout — scrollHeight is meaningless until the cards lay out.
requestAnimationFrame(updateHomeGridScrollState);
}
// With enough playlists the grid still has to scroll. Flag when it genuinely
// overflows (and whether it's at the end) so the CSS fades the bottom edge
// instead of slicing the last row against a hard border.
function updateHomeGridScrollState() {
const grid = document.getElementById('homePlGrid');
if (!grid) return;
const overflows = grid.scrollHeight > grid.clientHeight + 1;
grid.classList.toggle('is-scrollable', overflows);
grid.classList.toggle('at-end', !overflows ||
grid.scrollTop + grid.clientHeight >= grid.scrollHeight - 2);
}
function currentList() {
@@ -3353,6 +3369,8 @@ function wireUI() {
// ---- Empty-home playlist grid ----
$('homePlNewBtn').addEventListener('click', () => newPlaylist(null));
$('homePlGrid').addEventListener('scroll', updateHomeGridScrollState, { passive: true });
window.addEventListener('resize', updateHomeGridScrollState);
els.searchForm.addEventListener('submit', async (e) => {
e.preventDefault();