Centralised SmartList for grids and lists

This commit is contained in:
James Barnsley
2021-03-07 21:05:07 +13:00
parent 886c34985b
commit 144e955376
17 changed files with 677 additions and 856 deletions

View File

@ -51,15 +51,6 @@ const Artwork = ({
}
class Queue extends React.Component {
constructor(props) {
super(props);
this.state = {
limit: 50,
per_page: 50,
};
}
componentDidMount() {
const {
uiActions: {
@ -93,21 +84,6 @@ class Queue extends React.Component {
}
}
loadMore = () => {
const { limit, per_page } = this.state;
const { location, history } = this.props;
const new_limit = limit + per_page;
this.setState({ limit: new_limit });
// Set our pagination to location state
const state = location && location.state
? location.state
: {};
state.limit = new_limit;
history.replace({ state });
}
removeTracks = (track_indexes) => {
const {
queue_tracks,
@ -218,10 +194,6 @@ class Queue extends React.Component {
},
} = this.props;
const { limit } = this.state;
const total_queue_tracks = queue_tracks.length;
const tracks = queue_tracks.slice(0, limit);
let current_track_image = null;
if (current_track && current_track_uri) {
if (current_track.images !== undefined && current_track.images) {
@ -312,23 +284,13 @@ class Queue extends React.Component {
show_source_icon
track_context="queue"
className="queue-track-list"
tracks={tracks}
tracks={queue_tracks}
removeTracks={this.removeTracks}
playTracks={this.playTracks}
playTrack={this.playTrack}
reorderTracks={this.reorderTracks}
/>
</section>
<LazyLoadListener
loadKey={
total_queue_tracks > limit
? limit
: total_queue_tracks
}
showLoader={limit < total_queue_tracks}
loadMore={this.loadMore}
/>
</div>
</div>
);