Files
Psychotoxical-psysonic/src/components/artistDetail/ArtistTopTrackCover.tsx
T
cucadmuh 8443b3d4be fix(artist): align top-track covers with album grid cover path (#886)
* fix(artist): align top-track covers with album grid cover path

Top tracks now resolve album.id + album.coverArt like AlbumCard, use
the same useAlbumCoverRef/CoverArtImage dense pipeline, and batch-warm
covers on page load instead of a custom sparse resolver.

* docs: CHANGELOG and credits for PR #886 artist top-track covers

* fix(artist): match All Albums cover warm tier and prefetch on detail page

Warm top-track and discography covers at dense grid tier (140px) instead of
32px thumb tier so disk peek hits cached WebP. Register high-priority dense
prefetch like All Albums and ensure top-track cells at high priority so dense
defer-until-visible does not stall visible thumbs.

* fix(artist): satisfy tsc for top-track cover warm helpers

Use optional coverArt access in pushAlbumWarmRow and align album pick
types with topSongAlbumForCover (id + name + coverArt).
2026-05-28 22:47:38 +03:00

25 lines
963 B
TypeScript

import React from 'react';
import { CoverArtImage } from '../../cover/CoverArtImage';
import { useAlbumCoverRef } from '../../cover/useLibraryCoverRef';
import { COVER_ARTIST_TOP_TRACK_CSS_PX } from '../../cover/layoutSizes';
import type { TopSongAlbumCoverSource } from './topSongAlbumForCover';
/** 32px album thumb — same cover ref path as {@link AlbumCard} on artist pages. */
export default function ArtistTopTrackCover({ album }: { album: TopSongAlbumCoverSource }) {
const coverRef = useAlbumCoverRef(album.id, album.coverArt, undefined, { libraryResolve: false });
if (!coverRef) return null;
return (
<CoverArtImage
coverRef={coverRef}
displayCssPx={COVER_ARTIST_TOP_TRACK_CSS_PX}
surface="dense"
ensurePriority="high"
alt={`${album.name} Cover`}
loading="eager"
decoding="async"
style={{ width: '32px', height: '32px', borderRadius: '4px', objectFit: 'cover', flexShrink: 0 }}
/>
);
}