From a66feab53ec13ad2f0bcbedc8173951bffe753d5 Mon Sep 17 00:00:00 2001 From: ScreenTinker Date: Sat, 11 Apr 2026 22:10:48 -0500 Subject: [PATCH] Phase 2: playlists UI shows display count, auto-generated filter toggle List view: auto-generated playlists hidden by default with toggle checkbox. Cards show 'auto' badge and display count. Detail view shows display count in the header. Co-Authored-By: Claude Opus 4.6 --- frontend/js/views/playlists.js | 37 ++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/frontend/js/views/playlists.js b/frontend/js/views/playlists.js index d00bf1d..fb65f62 100644 --- a/frontend/js/views/playlists.js +++ b/frontend/js/views/playlists.js @@ -39,6 +39,8 @@ export function cleanup() { // ==================== LIST VIEW ==================== +let showAutoGenerated = false; + async function renderList(container) { container.innerHTML = ` - +
+ + +
Loading...
@@ -54,6 +62,10 @@ async function renderList(container) { `; document.getElementById('createPlaylistBtn').addEventListener('click', showCreateModal); + document.getElementById('showAutoToggle').addEventListener('change', (e) => { + showAutoGenerated = e.target.checked; + loadPlaylists(); + }); loadPlaylists(); } @@ -77,14 +89,30 @@ async function loadPlaylists() { return; } - grid.innerHTML = playlists.map(p => ` + const filtered = showAutoGenerated ? playlists : playlists.filter(p => !p.is_auto_generated); + if (!filtered.length) { + grid.innerHTML = ` +
+ ${playlists.length ? 'All playlists are auto-generated. Toggle "Show auto-generated" to see them.' : ''} +
+ `; + return; + } + + grid.innerHTML = filtered.map(p => `
-
${esc(p.name)}
+
+
${esc(p.name)}
+ ${p.is_auto_generated ? 'auto' : ''} +
${p.item_count} item${p.item_count !== 1 ? 's' : ''}
${p.description ? `
${esc(p.description)}
` : ''} -
Created ${formatDate(p.created_at)}
+
+ Created ${formatDate(p.created_at)} + ${p.display_count ? `${p.display_count} display${p.display_count !== 1 ? 's' : ''}` : ''} +
`).join(''); } catch (err) { @@ -160,6 +188,7 @@ function renderDetailContent(container, playlist) {

${esc(playlist.name)}

${playlist.description ? esc(playlist.description) : 'Add a description...'}
+ ${playlist.display_count ? `
Assigned to ${playlist.display_count} display${playlist.display_count !== 1 ? 's' : ''}
` : ''}