Loader for artist when completely empty

This commit is contained in:
James Barnsley
2018-04-10 20:47:37 +12:00
parent e0cec77996
commit 1c81006182

View File

@ -237,68 +237,55 @@ class Artist extends React.Component{
}
render(){
var scheme = helpers.uriSource(this.props.params.uri);
var scheme = helpers.uriSource(this.props.params.uri )
if (!this.props.artist){
if (helpers.isLoading(this.props.load_queue,['spotify_artists/'+helpers.getFromUri('artistid',this.props.params.uri), 'lastfm_method=artist.getInfo'])){
return (
<div className="body-loader loading">
<div className="loader"></div>
</div>
)
} else {
return null;
}
}
if (this.props.artist && this.props.artist.images){
var image = helpers.sizedImages(this.props.artist.images ).huge
var image = helpers.sizedImages(this.props.artist.images).huge;
} else {
var image = null
var image = null;
}
if (this.props.artist){
var is_spotify = (scheme == 'spotify')
if (this.props.artist.tracks_uris && this.props.artist.tracks_uris.length > 0){
var uris_to_play = this.props.artist.tracks_uris
} else {
var uris_to_play = this.props.artist.albums_uris
}
return (
<div className="view artist-view">
<div className="intro">
<Parallax image={image} />
<div className="liner">
<h1>{this.props.artist ? this.props.artist.name : null}</h1>
<div className="actions">
<button className="primary" onClick={e => this.props.mopidyActions.playURIs(uris_to_play, this.props.artist.uri)}>Play</button>
{is_spotify ? <FollowButton className="white" uri={this.props.params.uri} removeText="Remove from library" addText="Add to library" is_following={this.inLibrary()} /> : null}
<ContextMenuTrigger className="white" onTrigger={e => this.handleContextMenu(e)} />
</div>
{ this.renderSubViewMenu() }
</div>
</div>
<div className="content-wrapper">
{this.renderBody()}
</div>
</div>
);
var is_spotify = (scheme == 'spotify')
if (this.props.artist.tracks_uris && this.props.artist.tracks_uris.length > 0){
var uris_to_play = this.props.artist.tracks_uris
} else {
return (
<div className="view artist-view">
<div className="intro">
<Parallax />
<div className="liner">
<h1>
<span className="placeholder"></span>
</h1>
<div className="actions">
<button className="placeholder">&nbsp;</button>
<button className="placeholder">&nbsp;</button>
</div>
{ this.renderSubViewMenu() }
var uris_to_play = this.props.artist.albums_uris
}
return (
<div className="view artist-view">
<div className="intro">
<Parallax image={image} />
<div className="liner">
<h1>{this.props.artist ? this.props.artist.name : null}</h1>
<div className="actions">
<button className="primary" onClick={e => this.props.mopidyActions.playURIs(uris_to_play, this.props.artist.uri)}>Play</button>
{is_spotify ? <FollowButton className="white" uri={this.props.params.uri} removeText="Remove from library" addText="Add to library" is_following={this.inLibrary()} /> : null}
<ContextMenuTrigger className="white" onTrigger={e => this.handleContextMenu(e)} />
</div>
</div>
<div className="content-wrapper">
{this.renderBody()}
{ this.renderSubViewMenu() }
</div>
</div>
);
}
<div className="content-wrapper">
{this.renderBody()}
</div>
</div>
);
}
}