feat: artist cards navigate-only (no play); add Top Songs + Shuffle buttons to artist detail page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
a907773afb
commit
8a256b9463
3 files changed
+35
-6
No files matched your search
+30
-6
@@ -126,8 +126,8 @@ export async function loadArtists() {
|
||||
g.innerHTML = '';
|
||||
all.forEach(a => {
|
||||
const c = makeCard(a.name, a.albumCount+' Alben', null, '🎤');
|
||||
c.querySelector('.card-art').onclick = (e) => { e.stopPropagation(); quickPlayArtist(a); };
|
||||
c.querySelector('.card-info').onclick = () => navigate('artist-detail', a);
|
||||
c.classList.add('artist-card');
|
||||
c.onclick = () => navigate('artist-detail', a);
|
||||
g.appendChild(c);
|
||||
getArtistImage(a.id).then(imgUrl => {
|
||||
if(!imgUrl) return;
|
||||
@@ -272,6 +272,31 @@ export async function loadArtistDetail(artist) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Action bar ──
|
||||
const actionBar = document.getElementById('artist-action-bar');
|
||||
if(actionBar) {
|
||||
actionBar.innerHTML = '';
|
||||
if(topSongs.length || ndAlbums.length) {
|
||||
const playTopBtn = document.createElement('button');
|
||||
playTopBtn.className = 'artist-action-btn';
|
||||
playTopBtn.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><polygon points="5 3 19 12 5 21 5 3"/></svg> Top Songs`;
|
||||
playTopBtn.onclick = () => topSongs.length ? playQueue(topSongs, 0) : quickPlayArtist(artist);
|
||||
|
||||
const shuffleBtn = document.createElement('button');
|
||||
shuffleBtn.className = 'artist-action-btn';
|
||||
shuffleBtn.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="16 3 21 3 21 8"/><line x1="4" y1="20" x2="21" y2="3"/><polyline points="21 16 21 21 16 21"/><line x1="15" y1="15" x2="21" y2="21"/></svg> Shuffle`;
|
||||
shuffleBtn.onclick = async () => {
|
||||
S.shuffle = true;
|
||||
localStorage.setItem('ns_shuffle', '1');
|
||||
import('./player.js').then(({ _applyShuffleRepeat }) => _applyShuffleRepeat());
|
||||
await quickPlayArtist(artist);
|
||||
};
|
||||
|
||||
actionBar.appendChild(playTopBtn);
|
||||
actionBar.appendChild(shuffleBtn);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Albums ──
|
||||
if(albEl) { albEl.innerHTML = ''; _renderArtistAlbums(albEl, ndAlbums, iAlbums, artist); }
|
||||
}
|
||||
@@ -574,15 +599,14 @@ export async function doLocalSearch(q) {
|
||||
const g = document.createElement('div'); g.className = 'scroll-row';
|
||||
artists.forEach(a => {
|
||||
const c = makeCard(a.name, a.albumCount+' Alben', null, '🎤');
|
||||
c.querySelector('.card-art').onclick = (e) => { e.stopPropagation(); quickPlayArtist(a); };
|
||||
c.querySelector('.card-info').onclick = () => navigate('artist-detail', a);
|
||||
c.classList.add('artist-card');
|
||||
c.onclick = () => navigate('artist-detail', a);
|
||||
g.appendChild(c);
|
||||
getArtistImage(a.id).then(img => {
|
||||
if(!img) return;
|
||||
const artEl = c.querySelector('.card-art');
|
||||
if(!artEl) return;
|
||||
artEl.innerHTML = `<img src="${img}" loading="lazy" onerror="this.parentNode.innerHTML='<div class=\\'no-art\\'>🎤</div>'"><div class="play-overlay"><button class="play-btn"><svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor"><polygon points="5 3 19 12 5 21 5 3"/></svg></button></div>`;
|
||||
artEl.onclick = (e) => { e.stopPropagation(); quickPlayArtist(a); };
|
||||
artEl.innerHTML = `<img src="${img}" loading="lazy" onerror="this.parentNode.innerHTML='<div class=\\'no-art\\'>🎤</div>'">`;
|
||||
});
|
||||
});
|
||||
s.appendChild(g); el.appendChild(s);
|
||||
|
||||
Reference in new issue
Block a user