import Button, { Color as ButtonColor } from '@/components/Button' import SvgIcon from '@/components/SvgIcon' import Cover from '@/components/Cover' import useArtist from '@/hooks/useArtist' import useArtistAlbums from '@/hooks/useArtistAlbums' import { resizeImage } from '@/utils/common' import dayjs from 'dayjs' import TracksGrid from '@/components/TracksGrid' import CoverRow, { Subtitle } from '@/components/CoverRow' import Skeleton from '@/components/Skeleton' import { Fragment } from 'react' const Artist = () => { const params = useParams() const { data: artist, isLoading } = useArtist({ id: Number(params.id) || 0, }) const { data: albumsRaw, isLoading: isLoadingAlbum } = useArtistAlbums({ id: Number(params.id) || 0, limit: 1000, }) const albums = useMemo(() => { if (!albumsRaw?.hotAlbums) return [] return albumsRaw.hotAlbums.filter( album => album.type === '专辑' && ['混音版', '精选集', 'Remix'].includes(album.subType) === false && album.size > 1 ) }, [albumsRaw?.hotAlbums]) const singles = useMemo(() => { if (!albumsRaw?.hotAlbums) return [] return albumsRaw.hotAlbums.filter( album => album.type !== '专辑' || ['混音版', '精选集', 'Remix'].includes(album.subType) || album.size === 1 ) }, [albumsRaw?.hotAlbums]) const latestAlbum = useMemo(() => { if (!albumsRaw || !albumsRaw.hotAlbums) return return albumsRaw.hotAlbums[0] }, [albumsRaw]) const coverImage = resizeImage(artist?.artist?.img1v1Url || '', 'md') return (
{coverImage && ( )}
{/* Header */}
{artist?.artist.name}
{/* Latest release */}
最新发行
{isLoadingAlbum ? ( ) : ( )}
{latestAlbum?.name}
{latestAlbum?.type} ·{' '} {dayjs(latestAlbum?.publishTime || 0).year()}
{/* Popular tracks */}
热门歌曲
{/* Albums */}
专辑
{/* Singles/EP */}
单曲和EP
) } export default Artist