Fixing spotify library artists/albums/tracks

This commit is contained in:
James Barnsley
2016-11-19 11:13:01 +13:00
parent 7f9b92ea17
commit d8e430858c
5 changed files with 71 additions and 29 deletions

View File

@ -22,8 +22,8 @@ class LibraryAlbums extends React.Component{
}
loadMore(){
if( !this.props.spotify.library_albums || !this.props.spotify.library_albums.next ) return
this.props.spotifyActions.getURL( this.props.spotify.library_albums.next, 'SPOTIFY_LIBRARY_ALBUMS_LOADED_MORE' );
if( !this.props.spotify.library_albums_more ) return
this.props.spotifyActions.getURL( this.props.spotify.library_albums_more, 'SPOTIFY_LIBRARY_ALBUMS_LOADED_MORE' );
}
render(){
@ -34,7 +34,7 @@ class LibraryAlbums extends React.Component{
title="My albums"
/>
<section className="grid-wrapper">
{ this.props.spotify.library_albums ? <AlbumGrid albums={this.props.spotify.library_albums.items} /> : null }
{ this.props.spotify.library_albums ? <AlbumGrid albums={this.props.spotify.library_albums} /> : null }
</section>
<LazyLoadListener loadMore={ () => this.loadMore() }/>
</div>

View File

@ -23,19 +23,16 @@ class LibraryArtists extends React.Component{
}
loadMore(){
if( !this.props.spotify.library_artists || !this.props.spotify.library_artists.next ) return
this.props.spotifyActions.getURL( this.props.spotify.library_artists.next, 'SPOTIFY_LIBRARY_ARTISTS_LOADED_MORE' );
if( !this.props.spotify.library_artists_more ) return
this.props.spotifyActions.getURL( this.props.spotify.library_artists_more, 'SPOTIFY_LIBRARY_ARTISTS_LOADED_MORE' );
}
render(){
return (
<div className="view library-artists-view">
<Header
icon="mic"
title="My artists"
/>
<Header icon="mic" title="My artists" />
<section className="grid-wrapper">
{ this.props.spotify.library_artists ? <ArtistGrid artists={this.props.spotify.library_artists.items} /> : null }
{ this.props.spotify.library_artists ? <ArtistGrid artists={this.props.spotify.library_artists} /> : null }
</section>
<LazyLoadListener loadMore={ () => this.loadMore() }/>
</div>

View File

@ -6,6 +6,7 @@ import { Link } from 'react-router'
import TrackList from '../../components/TrackList'
import Header from '../../components/Header'
import LazyLoadListener from '../../components/LazyLoadListener'
import * as mopidyActions from '../../services/mopidy/actions'
import * as spotifyActions from '../../services/spotify/actions'
@ -21,13 +22,19 @@ class LibraryTracks extends React.Component{
this.props.spotifyActions.getLibraryTracks();
}
loadMore(){
if( !this.props.spotify.library_tracks_more ) return
this.props.spotifyActions.getURL( this.props.spotify.library_tracks_more, 'SPOTIFY_LIBRARY_TRACKS_LOADED_MORE' );
}
render(){
return (
<div className="view library-tracks-view">
<Header icon="music" title="My tracks" />
<section className="list-wrapper">
{ this.props.spotify.library_tracks ? <TrackList tracks={this.props.spotify.library_tracks.items} /> : null }
{ this.props.spotify.library_tracks ? <TrackList tracks={this.props.spotify.library_tracks} /> : null }
</section>
<LazyLoadListener loadMore={ () => this.loadMore() }/>
</div>
);
}