Track loading
This commit is contained in:
@ -28,17 +28,10 @@ class FollowButton extends React.Component{
|
||||
}
|
||||
|
||||
var className = '';
|
||||
|
||||
// Inherit passed-down classes
|
||||
if (this.props.className){
|
||||
className += ' '+this.props.className;
|
||||
}
|
||||
|
||||
// Loader
|
||||
if (helpers.isLoading(this.props.load_queue,['/following','/followers','me/albums/contains/?ids=','me/albums/?ids='])){
|
||||
className += ' working';
|
||||
}
|
||||
|
||||
if (!this.props.spotify_authorized){
|
||||
return <button className={className+' disabled'} onClick={e => this.props.uiActions.createNotification({content: 'You must authorize Spotify first', type: 'warning'})}>{this.props.addText}</button>
|
||||
} else if (this.props.is_following === true){
|
||||
|
||||
@ -45,11 +45,13 @@ export default class GridItem extends React.Component{
|
||||
switch (helpers.uriType(item.uri)){
|
||||
|
||||
case 'playlist':
|
||||
return (
|
||||
<span>
|
||||
{item.tracks_total ? item.tracks_total : 0} tracks
|
||||
</span>
|
||||
)
|
||||
if (item.tracks_total){
|
||||
return (
|
||||
<span>
|
||||
{item.tracks_total} tracks
|
||||
</span>
|
||||
);
|
||||
}
|
||||
break
|
||||
|
||||
case 'artist':
|
||||
|
||||
@ -32,6 +32,9 @@ class Services extends React.Component{
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
if (this.props.spotify.me && this.props.core.users[this.props.spotify.me.id] === undefined){
|
||||
this.props.spotifyActions.getMe();
|
||||
}
|
||||
if (this.props.lastfm.session && this.props.core.users["lastfm:user:"+this.props.lastfm.session.name] === undefined){
|
||||
this.props.lastfmActions.getMe();
|
||||
}
|
||||
|
||||
@ -128,9 +128,7 @@ class Snapcast extends React.Component{
|
||||
render(){
|
||||
if (!this.props.snapcast_enabled){
|
||||
return (
|
||||
<div>
|
||||
To enable Snapcast, edit your <code>mopidy.conf</code> file
|
||||
</div>
|
||||
<p className="message warning">To enable Snapcast, edit your <code>mopidy.conf</code> file</p>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ class Album extends React.Component{
|
||||
|
||||
var album = helpers.collate(this.props.album, {tracks: this.props.tracks, artists: this.props.artists});
|
||||
|
||||
if (album.tracks && album.tracks.length <= 0 && helpers.isLoading(this.props.load_queue,['spotify_albums/'+helpers.getFromUri('albumid',this.props.params.uri)])){
|
||||
if (!album.tracks_uris || (album.tracks_uris && !album.tracks) || (album.tracks_uris.length !== album.tracks.length)){
|
||||
var is_loading_tracks = true;
|
||||
} else {
|
||||
var is_loading_tracks = false;
|
||||
|
||||
@ -205,7 +205,7 @@ class Artist extends React.Component{
|
||||
}
|
||||
];
|
||||
|
||||
if (artist.tracks && artist.tracks.length <= 0 && helpers.isLoading(this.props.load_queue,['spotify_artists/'+helpers.getFromUri('artistid',artist.uri)+'/top-tracks'])){
|
||||
if (!artist.tracks_uris || (artist.tracks_uris && !artist.tracks) || (artist.tracks_uris.length !== artist.tracks.length)){
|
||||
var is_loading_tracks = true;
|
||||
} else {
|
||||
var is_loading_tracks = false;
|
||||
|
||||
@ -191,7 +191,7 @@ class Playlist extends React.Component{
|
||||
context = 'editable-playlist';
|
||||
}
|
||||
|
||||
if (playlist.tracks && playlist.tracks.length <= 0 && helpers.isLoading(this.props.load_queue,['spotify_playlists/'+playlist_id, 'spotify_playlists/'+playlist_id+'/tracks'])){
|
||||
if (!playlist.tracks_uris || (playlist.tracks_uris && !playlist.tracks) || (playlist.tracks_uris.length !== playlist.tracks.length)){
|
||||
var is_loading_tracks = true;
|
||||
} else {
|
||||
var is_loading_tracks = false;
|
||||
|
||||
Reference in New Issue
Block a user