fix(ui): show artist and album in track drag ghost

Single track: title (bold) + artist · album (subtle subtitle).
Multi-select: "N tracks" count as before.

cc
This commit is contained in:
vicrodh committed 2026-04-07 17:55:39 -06:00
1 parent 73b0da44ad
commit e71d634cdf
1 file changed
+20 -8
+20 -8
View File
@@ -167,26 +167,38 @@
// Custom drag ghost: compact, semi-transparent pill
const ghost = document.createElement('div');
const count = ids.length;
ghost.textContent = count > 1 ? `${count} tracks` : title;
Object.assign(ghost.style, {
position: 'fixed',
top: '-1000px',
padding: '6px 14px',
maxWidth: '220px',
padding: '8px 14px',
maxWidth: '260px',
borderRadius: '8px',
background: 'rgba(30, 30, 40, 0.85)',
color: '#fff',
fontSize: '12px',
fontWeight: '500',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
lineHeight: '1.4',
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
border: '1px solid rgba(255,255,255,0.1)',
opacity: '0.9',
});
if (count > 1) {
ghost.textContent = `${count} tracks`;
ghost.style.fontWeight = '500';
} else {
const titleEl = document.createElement('div');
titleEl.textContent = title;
Object.assign(titleEl.style, { fontWeight: '600', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' });
ghost.appendChild(titleEl);
const sub = [artist, album].filter(Boolean).join(' · ');
if (sub) {
const subEl = document.createElement('div');
subEl.textContent = sub;
Object.assign(subEl.style, { fontSize: '10px', color: 'rgba(255,255,255,0.55)', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', marginTop: '1px' });
ghost.appendChild(subEl);
}
}
document.body.appendChild(ghost);
e.dataTransfer.setDragImage(ghost, 0, 16);
e.dataTransfer.setDragImage(ghost, 0, 20);
requestAnimationFrame(() => ghost.remove());
}
</script>