refactor(web): migrate 4 open-coded cover URL sites to coverUrl() helper (C1 small-win)

This commit is contained in:
2026-05-08 11:26:50 -04:00
parent 47c316e211
commit efef9934d4
5 changed files with 11 additions and 8 deletions
@@ -1,7 +1,7 @@
<script lang="ts">
import type { TrackRef } from '$lib/api/types';
import { playQueue, enqueueTrack } from '$lib/player/store.svelte';
import { FALLBACK_COVER } from '$lib/media/covers';
import { FALLBACK_COVER, coverUrl } from '$lib/media/covers';
import { Plus } from 'lucide-svelte';
import LikeButton from './LikeButton.svelte';
import TrackMenu from './TrackMenu.svelte';
@@ -16,7 +16,7 @@
index: number;
} = $props();
const coverUrl = $derived(`/api/albums/${track.album_id}/cover`);
const cover = $derived(coverUrl(track.album_id));
function onImgError(e: Event) {
(e.currentTarget as HTMLImageElement).src = FALLBACK_COVER;
@@ -42,7 +42,7 @@
>
<div class="aspect-square w-full overflow-hidden rounded-md bg-surface-hover">
<img
src={coverUrl}
src={cover}
alt=""
class="h-full w-full object-cover transition-transform group-hover:scale-[1.03]"
loading="lazy"