Playlists stored in universal store, indexes stored for each view
This commit is contained in:
@ -17,13 +17,11 @@ class DiscoverCategory extends React.Component{
|
||||
|
||||
componentDidMount(){
|
||||
this.props.spotifyActions.getCategory( this.props.params.id );
|
||||
this.props.spotifyActions.getCategoryPlaylists( this.props.params.id );
|
||||
}
|
||||
|
||||
componentWillReceiveProps( nextProps ){
|
||||
if( nextProps.params.id != this.props.params.id ){
|
||||
this.props.spotifyActions.getCategory( nextProps.params.id );
|
||||
this.props.spotifyActions.getCategoryPlaylists( nextProps.params.id );
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +37,7 @@ class DiscoverCategory extends React.Component{
|
||||
<div className="view discover-categories-view">
|
||||
<Header icon="grid" title={this.props.spotify.category.name} />
|
||||
<section className="grid-wrapper">
|
||||
{ this.props.spotify.category_playlists ? <PlaylistGrid playlists={this.props.spotify.category_playlists.items} /> : null }
|
||||
{ this.props.spotify.category.playlists ? <PlaylistGrid playlists={this.props.spotify.category.playlists} /> : null }
|
||||
</section>
|
||||
<LazyLoadListener loadMore={ () => this.loadMore() }/>
|
||||
</div>
|
||||
|
||||
@ -20,11 +20,22 @@ class DiscoverFeatured extends React.Component{
|
||||
}
|
||||
|
||||
render(){
|
||||
|
||||
var playlists = []
|
||||
if (this.props.featured_playlists){
|
||||
for (var i = 0; i < this.props.featured_playlists.playlists.length; i++){
|
||||
var uri = this.props.featured_playlists.playlists[i]
|
||||
if (this.props.playlists.hasOwnProperty(uri)){
|
||||
playlists.push(this.props.playlists[uri])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="view discover-featured-view">
|
||||
<Header icon="star" title="Featured playlists" />
|
||||
<section className="grid-wrapper">
|
||||
{ this.props.spotify.featured_playlists ? <PlaylistGrid playlists={this.props.spotify.featured_playlists.playlists.items} /> : null }
|
||||
{ playlists ? <PlaylistGrid playlists={playlists} /> : null }
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
@ -39,7 +50,10 @@ class DiscoverFeatured extends React.Component{
|
||||
**/
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return state;
|
||||
return {
|
||||
featured_playlists: state.spotify.featured_playlists,
|
||||
playlists: state.ui.playlists
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
|
||||
Reference in New Issue
Block a user