trial for artist name

This commit is contained in:
danis
2023-09-07 10:31:03 +02:00
parent f85c30a53b
commit 16cd794e3b

View File

@@ -15,6 +15,12 @@ type GenreDetailsViewProps = {
const GenreDetailsView = ({ genreId }: RouteProps<GenreDetailsViewProps>) => {
const genreQuery = useQuery(API.getGenre(genreId))
const songsQuery = useQuery(API.getSongsByGenre(genreId))
const artistQueries = useQueries(songsQuery.data.map((song) => song.artistId).map((artistId) => API.getArtist(artistId)));
const songWithArtist = songsQuery.data.map((song) => ({
...song,
artist: artistQueries.find((query) => query.data.id == song.artistId)
})).filter((song) => song.artist !== undefined);
const screenSize = useBreakpointValue({ base: "small", md: "big" });
const isMobileView = screenSize == "small";
const navigation = useNavigation();
@@ -48,10 +54,10 @@ const GenreDetailsView = ({ genreId }: RouteProps<GenreDetailsViewProps>) => {
mt={4}
>
<CardGridCustom
content={songsQuery.data.map((songData) => ({
content={songWithArtist.map((songData) => ({
name: songData.name,
cover: songData.cover,
artistName: songData.artistId.toString(),
artistName: songData.artist.name,
songId: songData.id,
onPress: () => {
API.createSearchHistoryEntry(songData.name, 'song');