import useIsMobile from '@/web/hooks/useIsMobile' import useAppleMusicArtist from '@/web/api/hooks/useAppleMusicArtist' import { cx, css } from '@emotion/css' import { useTranslation } from 'react-i18next' import i18next from 'i18next' const ArtistInfo = ({ artist, isLoading }: { artist?: Artist; isLoading: boolean }) => { const { t, i18n } = useTranslation() const isMobile = useIsMobile() const { data: artistFromApple, isLoading: isLoadingArtistFromApple } = useAppleMusicArtist( artist?.id || 0 ) return (
{/* Name */} {isLoading ? (
PLACEHOLDER
) : (
{artist?.name}
)} {/* Type */} {isLoading ? (
Artist
) : (
Artist
)} {/* Counts */} {isLoading ? (
PLACEHOLDER12345
) : (
{t('common.track-with-count', { count: artist?.musicSize })} ·{' '} {t('common.album-with-count', { count: artist?.albumSize })} ·{' '} {t('common.video-with-count', { count: artist?.mvSize })}
)} {/* Description */} {!isMobile && (isLoading || isLoadingArtistFromApple ? (
PLACEHOLDER1234567890
) : (
{artistFromApple?.artistBio?.[i18n.language.replace('-', '_')] || artist?.briefDesc}
))}
) } export default ArtistInfo