-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArtistDetails.jsx
33 lines (26 loc) · 998 Bytes
/
ArtistDetails.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { useParams } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { DetailsHeader, Error, Loader, RelatedSongs } from '../components';
import { useGetArtistDetailsQuery } from '../redux/services/shazamCore';
const ArtistDetails = () => {
const { id: artistId } = useParams();
const { activeSong, isPlaying } = useSelector((state) => state.player);
const { data: artistData, isFetching: isFetchingArtistDetails, error } = useGetArtistDetailsQuery(artistId);
if (isFetchingArtistDetails) return <Loader title="Loading artist details" />;
if (error) return <Error />;
return (
<div className="flex flex-col">
<DetailsHeader
artistId={artistId}
artistData={artistData}
/>
<RelatedSongs
data={Object.values(artistData?.songs)}
artistId={artistId}
isPlaying={isPlaying}
activeSong={activeSong}
/>
</div>
);
};
export default ArtistDetails;