import { IGenre, IPlaylist } from "../models/IModels";
import { getPlaylistsByGenre } from "../API/api";
import { PlaylistsBlock } from "./PlaylistsBlock";

export function FullPlaylistBlock({playlists}: {playlists: IPlaylist[]}, {genres}: {genres: IGenre[]}) {

    let genres_list: string[] = [];

    let list_of_playlist_list = [];

    {for (let genre of genres) {
        genres_list.push(genre.name);
    }
    
    for (let genre of genres) {
        list_of_playlist_list.push(getPlaylistsByGenre(genre.name, playlists));
    }

    const result = [];
    for (let list of list_of_playlist_list) {
        result.push(
            <PlaylistsBlock playlists={list}/>
        )
    }

    return (
        <div className="container">
            <h5>Плейлисты</h5>
            {result}
        </div>
    )
    }
}