Add empty-state designs for empty playlists and history
Replaces bare status text with visual empty-state components: - History: clock icon, 'Nothing watched yet' title, description, 'Search videos' CTA - Playlist: music icon, 'This playlist is empty' title, description with tip, 'Browse videos' CTA - Search: unchanged (hero landing handles this case) - CTA buttons navigate to search view for quick action
This commit is contained in:
@@ -596,11 +596,44 @@ function renderList() {
|
||||
}
|
||||
|
||||
if (!list.length) {
|
||||
els.status.classList.remove('hidden');
|
||||
els.status.textContent =
|
||||
view.type === 'search' ? 'Search for something to begin.'
|
||||
: view.type === 'history' ? 'Nothing watched yet.'
|
||||
: 'This playlist is empty. Add videos from search.';
|
||||
els.status.classList.add('hidden');
|
||||
els.cards.innerHTML = '';
|
||||
const empty = document.createElement('div');
|
||||
empty.className = 'empty-state';
|
||||
|
||||
if (view.type === 'search') {
|
||||
// Hero landing is already in the player pane — list pane stays bare.
|
||||
els.status.classList.remove('hidden');
|
||||
els.status.textContent = 'Search for something to begin.';
|
||||
return;
|
||||
}
|
||||
|
||||
if (view.type === 'history') {
|
||||
empty.innerHTML = `
|
||||
<div class="empty-icon">🕘</div>
|
||||
<h3 class="empty-title">Nothing watched yet</h3>
|
||||
<p class="empty-desc">Your viewing history shows up here once you start playing videos.</p>
|
||||
`;
|
||||
const cta = document.createElement('button');
|
||||
cta.className = 'empty-cta';
|
||||
cta.textContent = '🔍 Search videos';
|
||||
cta.addEventListener('click', () => { view = { type: 'search' }; render(); });
|
||||
empty.appendChild(cta);
|
||||
} else {
|
||||
// Playlist view — empty
|
||||
empty.innerHTML = `
|
||||
<div class="empty-icon">🎵</div>
|
||||
<h3 class="empty-title">This playlist is empty</h3>
|
||||
<p class="empty-desc">Add videos from search results or use the <strong>+ Playlist</strong> button while playing.</p>
|
||||
`;
|
||||
const cta = document.createElement('button');
|
||||
cta.className = 'empty-cta';
|
||||
cta.textContent = '🔍 Browse videos';
|
||||
cta.addEventListener('click', () => { view = { type: 'search' }; render(); });
|
||||
empty.appendChild(cta);
|
||||
}
|
||||
|
||||
els.cards.appendChild(empty);
|
||||
return;
|
||||
}
|
||||
els.status.classList.add('hidden');
|
||||
|
||||
Reference in New Issue
Block a user