import type { SubsonicArtist } from '../api/subsonicTypes'; import React from 'react'; import { useNavigate } from 'react-router-dom'; import { Users } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { CoverArtImage } from '../cover/CoverArtImage'; import { coverArtIdFromArtist } from '../cover/ids'; import { COVER_DENSE_GRID_MIN_CELL_CSS_PX } from '../cover/layoutSizes'; interface Props { artist: SubsonicArtist; /** Appended to `/artist/:id`, e.g. `lossless=1`. */ linkQuery?: string; } export default function ArtistCardLocal({ artist, linkQuery }: Props) { const { t } = useTranslation(); const navigate = useNavigate(); const coverId = coverArtIdFromArtist(artist); const href = linkQuery ? `/artist/${artist.id}?${linkQuery}` : `/artist/${artist.id}`; return (
navigate(href)}>
{artist.coverArt || artist.id ? ( { e.currentTarget.style.display = 'none'; e.currentTarget.parentElement?.classList.add('fallback-visible'); }} /> ) : ( )}
{artist.name} {typeof artist.albumCount === 'number' && ( {t('artists.albumCount', { count: artist.albumCount })} )}
); }