fix: hero label shows source (Meistgespielt/Zuletzt gehört); play count column always visible when enabled
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
3128b06b24
commit
da185e1d96
2 files changed
+7
-4
No files matched your search
+3
-2
@@ -45,8 +45,9 @@ export function makeSongItem(s, idx, list, { noArtistLink = false, noAlbumLink =
|
||||
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>`
|
||||
: '';
|
||||
const playsHtml = S.cfg.showPlayCount && s.playCount
|
||||
? `<span class="song-plays">${s.playCount.toLocaleString()}<span class="song-plays-x">×</span></span>` : '';
|
||||
const playsHtml = S.cfg.showPlayCount
|
||||
? `<span class="song-plays">${s.playCount ? s.playCount.toLocaleString() + '<span class="song-plays-x">×</span>' : '—'}</span>`
|
||||
: '';
|
||||
el.innerHTML = `<div class="song-num">${idx+1}</div>
|
||||
<div class="song-thumb">${cv ? `<img src="${cv}" loading="lazy" onerror="this.parentNode.innerHTML='<div class=\\'no-art\\'>♪</div>'">` : '<div class="no-art">♪</div>'}</div>
|
||||
<div class="song-info">
|
||||
|
||||
+4
-2
@@ -130,11 +130,13 @@ async function loadHeroCard() {
|
||||
]);
|
||||
const freqList = freqRes.status === 'fulfilled' ? (freqRes.value.albumList2?.album || []) : [];
|
||||
const recList = recRes.status === 'fulfilled' ? (recRes.value.albumList2?.album || []) : [];
|
||||
// Deduplicate by id, prefer frequent (weighted taste signal), pad with recent
|
||||
// Deduplicate by id, tag source so we can show the right label
|
||||
const freqIds = new Set(freqList.map(a => a.id));
|
||||
const seen = new Set();
|
||||
const pool = [...freqList, ...recList].filter(a => a.id && !seen.has(a.id) && seen.add(a.id));
|
||||
const album = pool.length ? pool[Math.floor(Math.random() * pool.length)] : null;
|
||||
if (!album) return;
|
||||
const heroLabel = freqIds.has(album.id) ? 'Meistgespielt' : 'Zuletzt gehört';
|
||||
const bgUrl = coverUrl(album.coverArt, 1024);
|
||||
const thumbUrl = coverUrl(album.coverArt, 512);
|
||||
el.innerHTML = `
|
||||
@@ -142,7 +144,7 @@ async function loadHeroCard() {
|
||||
<div class="home-hero-overlay">
|
||||
${thumbUrl ? `<img class="home-hero-cover" src="${thumbUrl}" alt="${esc(album.name)}">` : ''}
|
||||
<div class="home-hero-info">
|
||||
<div class="home-hero-label">Meistgespielt</div>
|
||||
<div class="home-hero-label">${heroLabel}</div>
|
||||
<div class="home-hero-title">${esc(album.name)}</div>
|
||||
<div class="home-hero-artist">${esc(album.artist || '')}</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user