Hide webplayer when no song is in playlist

This commit is contained in:
Lucas Verney 2016-08-11 19:33:05 +02:00
parent 4e12da3a22
commit b7f2f32e1d
5 changed files with 25 additions and 20 deletions

View File

@ -89,6 +89,10 @@ class WebPlayerCSSIntl extends Component {
<div className="col-xs-12"> <div className="col-xs-12">
<img src={art} width="200" height="200" alt={formatMessage(webplayerMessages["app.common.art"])} ref="art" styleName="art" /> <img src={art} width="200" height="200" alt={formatMessage(webplayerMessages["app.common.art"])} ref="art" styleName="art" />
<div ref="artText"> <div ref="artText">
{
(artistName && songTitle)
? (
<div>
<h2>{songTitle}</h2> <h2>{songTitle}</h2>
<h3> <h3>
<span className="text-capitalize"> <span className="text-capitalize">
@ -96,6 +100,10 @@ class WebPlayerCSSIntl extends Component {
</span> { artistName } </span> { artistName }
</h3> </h3>
</div> </div>
)
: null
}
</div>
</div> </div>
</div> </div>

View File

@ -65,11 +65,6 @@ class WebPlayer extends Component {
if (!this.howl) { if (!this.howl) {
// Build a new Howler object with current song to play // Build a new Howler object with current song to play
const url = props.currentSong.get("url"); const url = props.currentSong.get("url");
if (!url) {
// TODO: Error handling
console.error("URL not found.");
return;
}
this.howl = new Howl({ this.howl = new Howl({
src: [url], src: [url],
html5: true, // Use HTML5 by default to allow streaming html5: true, // Use HTML5 by default to allow streaming
@ -114,7 +109,9 @@ class WebPlayer extends Component {
onMute: this.props.actions.toggleMute, onMute: this.props.actions.toggleMute,
}; };
return ( return (
<WebPlayerComponent {...webplayerProps} /> (this.props.playlist.size > 0)
? <WebPlayerComponent {...webplayerProps} />
: <div></div>
); );
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long