import { useParams, useNavigate } from 'react-router'; import { useTranslation } from 'react-i18next'; import { ScrollArea, IconButton, Button, Card } from '@olly/modern-sk'; import { useGetArtistQuery, useGetArtistAlbumsQuery, useGetArtistTracksQuery, } from '../../api/endpoints/library'; import { TrackRow } from '../../components/track/TrackRow'; import { ArtTile } from '../../components/common/ArtTile'; import { LoadingSkeleton } from '../../components/common/LoadingSkeleton'; import { ErrorState } from '../../components/common/ErrorState'; import { EmptyState } from '../../components/common/EmptyState'; import { useAppDispatch } from '../../hooks/useAppDispatch'; import { setQueue } from '../../store/slices/queue'; import { formatDuration } from '../../lib/format'; import { getCoverUrl } from '../../api/endpoints/streaming'; import type { Album } from '../../api/types'; export function ArtistDetailPage() { const { t } = useTranslation(); const { artistId } = useParams<{ artistId: string }>(); const navigate = useNavigate(); const dispatch = useAppDispatch(); const artistQuery = useGetArtistQuery(artistId ?? '', { skip: !artistId }); const albumsQuery = useGetArtistAlbumsQuery(artistId ?? '', { skip: !artistId, }); const tracksQuery = useGetArtistTracksQuery(artistId ?? '', { skip: !artistId, }); if (artistQuery.isLoading) { return (
{t('artist.type')}
{t('artist.meta', { albumCount: artist.albumCount, trackCount: artist.trackCount, })}
{t('artist.noAlbums')}
)} {albums.length > 0 && (