refactor(web): every cover thumbnail goes through Cover, so a failed load falls back (DRY W2)

Seven places drew their own cover image. The Missing, Suspect sources,
Hidden and Reports rows showed a Music2 icon only when the track had no
album; a cover that failed to load (not fetched yet, or gone) showed a
broken image. The queue row, play bar and Now Playing each set the
placeholder in their own onerror, and the playlist card's images had no
fallback at all.

Cover gains fallback="track" (the Music2 icon a track row uses), and all
seven go through it, so each one handles a missing src and a failed load
the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 03:09:15 -05:00
co-authored by Claude Opus 5.5
parent cceeaeb5c8
commit dae46ea980
11 changed files with 80 additions and 100 deletions
+5 -7
View File
@@ -2,7 +2,8 @@
import { GripVertical, X } from 'lucide-svelte';
import type { TrackRef } from '#lib/api/types.js';
import { playFromQueueIndex, removeFromQueue, moveQueueItem } from '#lib/player/store.svelte.js';
import { coverUrl, FALLBACK_COVER } from '#lib/media/covers.js';
import { coverUrl } from '#lib/media/covers.js';
import Cover from './Cover.svelte';
import { reorderDrag } from './reorder-drag';
import LikeButton from './LikeButton.svelte';
@@ -58,12 +59,9 @@
shadow is what keeps the glyph readable over pale covers without one.
-->
<div class="relative h-10 w-10 shrink-0">
<img
src={coverUrl(track.album_id)}
alt=""
onerror={(e) => ((e.currentTarget as HTMLImageElement).src = FALLBACK_COVER)}
class="h-10 w-10 rounded object-cover"
/>
<div class="h-10 w-10 overflow-hidden rounded">
<Cover src={coverUrl(track.album_id)} />
</div>
<button
type="button"
aria-label="Reorder track (use arrow keys)"