fix: bump SW cache to v39, split multi-artists by ' / ', name-search fallback for artist nav
- sw.js: ns-v38 → ns-v39 forces PWA cache clear so previous fixes take effect - components: split s.artist by ' / ' in makeSongItem — each part becomes its own clickable link; noArtistLink turns all parts into plain text - views: s_goArtist searches Navidrome by name when no artistId is available (needed for secondary artists that only have the primary artistId in the song) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9da48b88d8
commit
51babd9e41
3 files changed
+18
-7
No files matched your search
+8
-4
@@ -32,10 +32,14 @@ export function makeSongItem(s, idx, list, { noArtistLink = false, noAlbumLink =
|
||||
if(s.starred && !s._starred) s._starred = true;
|
||||
el.className = 'song-item' + (S.queue[S.qIdx]?.id === s.id ? ' playing' : '');
|
||||
const cv = coverUrl(s.coverArt, 60);
|
||||
const artistHtml = s.artistId||s.artist
|
||||
? (noArtistLink
|
||||
? `<span style="color:var(--text2)">${esc(s.artist||'')}</span>`
|
||||
: `<span class="song-link" onclick="event.stopPropagation();s_goArtist(event,'${esc(s.artist||'')}','${s.artistId||''}')">${esc(s.artist||'')}</span>`)
|
||||
const artistParts = (s.artist || '').split(' / ').filter(Boolean);
|
||||
const artistHtml = artistParts.length
|
||||
? artistParts.map((name, i) => {
|
||||
const aid = i === 0 ? (s.artistId || '') : '';
|
||||
return noArtistLink
|
||||
? `<span style="color:var(--text2)">${esc(name)}</span>`
|
||||
: `<span class="song-link" onclick="event.stopPropagation();s_goArtist(event,'${esc(name)}','${aid}')">${esc(name)}</span>`;
|
||||
}).join('<span style="color:var(--text3)"> / </span>')
|
||||
: '';
|
||||
const albumHtml = !noAlbumLink && (s.albumId||s.album)
|
||||
? `<span style="color:var(--text3)"> · </span><span class="song-link" onclick="event.stopPropagation();s_goAlbum(event,'${s.albumId||''}','${esc(s.album||'')}','${esc(s.artist||'')}','${s.artistId||''}')">${esc(s.album||'')}</span>`
|
||||
|
||||
+9
-2
@@ -840,9 +840,16 @@ export async function searchAndPreview(trackName, artistName) {
|
||||
} catch { toast('Suche fehlgeschlagen'); }
|
||||
}
|
||||
|
||||
export function s_goArtist(e, name, id) {
|
||||
export async function s_goArtist(e, name, id) {
|
||||
if(!name) return;
|
||||
navigate('artist-detail', {id: id||name, name});
|
||||
if(id) { navigate('artist-detail', {id, name}); return; }
|
||||
try {
|
||||
const r = await api('search3', `&query=${encodeURIComponent(name)}&artistCount=5&albumCount=0&songCount=0`);
|
||||
const artists = r.searchResult3?.artist || [];
|
||||
const match = artists.find(a => a.name.toLowerCase() === name.toLowerCase()) || artists[0];
|
||||
if(match) navigate('artist-detail', {id: match.id, name: match.name});
|
||||
else toast('Künstler nicht gefunden');
|
||||
} catch { toast('Suche fehlgeschlagen'); }
|
||||
}
|
||||
|
||||
export function s_goAlbum(e, albumId, albumName, artist, artistId) {
|
||||
|
||||
Reference in new issue
Block a user