import React from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import Loader from '../../components/Loader'; import TrackList from '../../components/TrackList'; import Header from '../../components/Header'; import LazyLoadListener from '../../components/LazyLoadListener'; import Icon from '../../components/Icon'; import * as uiActions from '../../services/ui/actions'; import * as mopidyActions from '../../services/mopidy/actions'; import * as spotifyActions from '../../services/spotify/actions'; import { isLoading } from '../../util/helpers'; import { I18n, i18n } from '../../locale'; class LibraryTracks extends React.Component { componentDidMount() { this.props.uiActions.setWindowTitle(i18n('library.tracks.title')); if (!this.props.spotify_available) { this.props.uiActions.createNotification({ level: 'warning', content: i18n('errors.enable_first', { provider: i18n('services.spotify.title') }), }); } else if (this.props.library_tracks === undefined) { this.props.spotifyActions.getLibraryTracks(); } } loadMore() { this.props.spotifyActions.getMore( this.props.library_tracks_more, null, { type: 'SPOTIFY_LIBRARY_TRACKS_LOADED_MORE', }, ); } playAll() { this.props.spotifyActions.getLibraryTracksAndPlay(); } render() { // Note trailing "?" makes sure our context menu in_library checks doesn't interfere if (isLoading(this.props.load_queue, ['spotify_me/tracks?'])) { return (