fix: fetch full song metadata for info modal via getSong API
Renders immediately with available data, then enriches with complete metadata (genre, bitrate, path, plays, etc.) from getSong response. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
068b491a1c
commit
23e8a7ddfb
1 file changed
+10
-1
@@ -199,7 +199,7 @@ document.addEventListener('click', e => {
|
||||
});
|
||||
|
||||
// ─── SONG INFO MODAL ───
|
||||
export function showSongInfo(s) {
|
||||
function _renderInfoModal(s) {
|
||||
const cv = coverUrl(s.coverArt, 200);
|
||||
document.getElementById('info-cover').innerHTML = cv
|
||||
? `<img src="${cv}" style="width:100%;height:100%;object-fit:cover">`
|
||||
@@ -224,7 +224,16 @@ export function showSongInfo(s) {
|
||||
document.getElementById('info-rows').innerHTML = fields.map(([l,v]) =>
|
||||
`<div class="info-row"><span class="info-label">${l}</span><span class="info-val">${esc(String(v))}</span></div>`
|
||||
).join('');
|
||||
}
|
||||
|
||||
export async function showSongInfo(s) {
|
||||
document.getElementById('info-modal').classList.add('open');
|
||||
_renderInfoModal(s);
|
||||
try {
|
||||
const r = await api('getSong', `&id=${s.id}`);
|
||||
const full = r.song;
|
||||
if (full) _renderInfoModal(full);
|
||||
} catch {}
|
||||
}
|
||||
export function closeInfoModal() { document.getElementById('info-modal').classList.remove('open'); }
|
||||
document.addEventListener('click', e => {
|
||||
|
||||
Reference in new issue
Block a user