Lazy loading cleanup

This commit is contained in:
James Barnsley
2018-09-03 08:24:49 +12:00
parent dbb5effbb9
commit 3344cf5db4
18 changed files with 10931 additions and 14038 deletions

View File

@ -183,7 +183,11 @@ class LibraryAlbums extends React.Component{
columns={columns}
className="album-list"
link_prefix={global.baseURL+"album/"} />
<LazyLoadListener loading={this.state.limit < total_albums} loadMore={() => this.setState({limit: this.state.limit + this.state.per_page})} />
<LazyLoadListener
loadKey={total_albums}
showLoader={this.state.limit < total_albums}
loadMore={() => this.setState({limit: this.state.limit + this.state.per_page})}
/>
</section>
)
} else {
@ -192,7 +196,11 @@ class LibraryAlbums extends React.Component{
<AlbumGrid
handleContextMenu={(e,item) => this.handleContextMenu(e,item)}
albums={albums} />
<LazyLoadListener loading={this.state.limit < total_albums} loadMore={() => this.setState({limit: this.state.limit + this.state.per_page})} />
<LazyLoadListener
loadKey={total_albums}
showLoader={this.state.limit < total_albums}
loadMore={() => this.setState({limit: this.state.limit + this.state.per_page})}
/>
</section>
)
}

View File

@ -159,7 +159,11 @@ class LibraryArtists extends React.Component{
columns={columns}
className="artist-list"
link_prefix={global.baseURL+"artist/"} />
<LazyLoadListener loading={this.state.limit < total_artists} loadMore={() => this.loadMore()} />
<LazyLoadListener
loadKey={total_artists}
showLoader={this.state.limit < total_artists}
loadMore={() => this.loadMore()}
/>
</section>
)
} else {
@ -168,7 +172,11 @@ class LibraryArtists extends React.Component{
<ArtistGrid
handleContextMenu={(e,item) => this.handleContextMenu(e,item)}
artists={artists} />
<LazyLoadListener loading={this.state.limit < total_artists} loadMore={() => this.loadMore()} />
<LazyLoadListener
loadKey={total_artists}
showLoader={this.state.limit < total_artists}
loadMore={() => this.loadMore()}
/>
</section>
)
}

View File

@ -155,7 +155,11 @@ class LibraryPlaylists extends React.Component{
columns={columns}
className="playlist-list"
link_prefix={global.baseURL+"playlist/"} />
<LazyLoadListener loading={this.state.limit < total_playlists} loadMore={() => this.setState({limit: this.state.limit + this.state.per_page})} />
<LazyLoadListener
loadKey="playlists"
loading={this.state.limit < total_playlists}
loadMore={() => this.setState({limit: this.state.limit + this.state.per_page})}
/>
</section>
)
} else {
@ -164,7 +168,11 @@ class LibraryPlaylists extends React.Component{
<PlaylistGrid
handleContextMenu={(e,item) => this.handleContextMenu(e,item)}
playlists={playlists} />
<LazyLoadListener loading={this.state.limit < total_playlists} loadMore={() => this.setState({limit: this.state.limit + this.state.per_page})} />
<LazyLoadListener
loadKey="playlists"
loading={this.state.limit < total_playlists}
loadMore={() => this.setState({limit: this.state.limit + this.state.per_page})}
/>
</section>
)
}

View File

@ -85,7 +85,11 @@ class LibraryTracks extends React.Component{
</Header>
<section className="content-wrapper">
<TrackList tracks={tracks} />
<LazyLoadListener loading={this.props.library_tracks_more} loadMore={() => this.loadMore()}/>
<LazyLoadListener
loadKey={this.props.library_tracks_more}
loading={this.props.library_tracks_more}
loadMore={() => this.loadMore()}
/>
</section>
</div>
);