From da185e1d967caf4877bd0bd236a005995613b5f6 Mon Sep 17 00:00:00 2001 From: Honey Date: Thu, 21 May 2026 09:53:43 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20hero=20label=20shows=20source=20(Meistge?= =?UTF-8?q?spielt/Zuletzt=20geh=C3=B6rt);=20play=20count=20column=20always?= =?UTF-8?q?=20visible=20when=20enabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- src/components.js | 5 +++-- src/views.js | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components.js b/src/components.js index 4c4ac49..fbf1f3d 100644 --- a/src/components.js +++ b/src/components.js @@ -45,8 +45,9 @@ export function makeSongItem(s, idx, list, { noArtistLink = false, noAlbumLink = const albumHtml = !noAlbumLink && (s.albumId||s.album) ? ` · ${esc(s.album||'')}` : ''; - const playsHtml = S.cfg.showPlayCount && s.playCount - ? `${s.playCount.toLocaleString()}×` : ''; + const playsHtml = S.cfg.showPlayCount + ? `${s.playCount ? s.playCount.toLocaleString() + '×' : '—'}` + : ''; el.innerHTML = `
${idx+1}
${cv ? `` : '
♪
'}
diff --git a/src/views.js b/src/views.js index 2ad3c4d..7e25107 100644 --- a/src/views.js +++ b/src/views.js @@ -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() {
${thumbUrl ? `${esc(album.name)}` : ''}
-
Meistgespielt
+
${heroLabel}
${esc(album.name)}
${esc(album.artist || '')}