refactor(web): migrate 4 open-coded cover URL sites to coverUrl() helper (C1 small-win)
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user