Wait for mopidy to load before connecting spotify

This commit is contained in:
James Barnsley
2017-09-11 08:37:37 +12:00
parent f625bfd3ca
commit cd8e6d0dc6
5 changed files with 26 additions and 14 deletions

View File

@ -47,6 +47,7 @@ export default class AddToPlaylistModal extends React.Component{
<div>
<h1>Add to playlist</h1>
<h2 className="grey-text">Select playlist to add {this.props.tracks_uris.length} track{this.props.tracks_uris.length>1?'s':null} to</h2>
{playlists.length <= 0 ? <div className="no-results">No playlists available</div> : null}
<div className="list small playlists">
{
playlists.map( playlist => {

View File

@ -22,25 +22,21 @@ class AuthorizationModal_Send extends React.Component{
return false;
}
render(){
renderConnectionsList(){
var connections = []
for (var connection_id in this.props.connections){
if (this.props.connections.hasOwnProperty(connection_id)) {
if (this.props.connections.hasOwnProperty(connection_id) && connection_id !== this.props.connection_id){
connections.push(this.props.connections[connection_id])
}
}
return (
<div>
<h1>Share Spotify authentication</h1>
<h2 className="grey-text">Send your authentication tokens to another client. When the recipient client imports this, their Iris will have full access to your Spotify account ({this.props.me.id}).</h2>
if (connections.length <= 0){
return <div className="no-results">No connections available</div>
} else {
return (
<div className="list small pusher-connection-list">
{
connections.map( (connection, index) => {
// don't list OUR connection
if (connection.connection_id == this.props.connection_id) return null
return (
<div className='list-item connection' key={connection.connection_id} onClick={ e => this.handleClick(e, connection.connection_id) }>
{ connection.username }
@ -51,6 +47,16 @@ class AuthorizationModal_Send extends React.Component{
})
}
</div>
)
}
}
render(){
return (
<div>
<h1>Share Spotify authentication</h1>
<h2 className="grey-text">Send your authentication tokens to another client. When the recipient client imports this, their Iris will have full access to your Spotify account ({this.props.me.id}).</h2>
{this.renderConnectionsList()}
</div>
)
}

View File

@ -23,10 +23,6 @@ const CoreMiddleware = (function(){
store.dispatch(pusherActions.connect())
store.dispatch(lastfmActions.connect())
if (store.getState().spotify.enabled){
store.dispatch(spotifyActions.connect())
}
next(action)
break

View File

@ -239,6 +239,7 @@ const MopidyMiddleware = (function(){
enabled: true
}
})
store.dispatch(spotifyActions.connect());
}
// If we haven't customised our search schemes, add all to search

View File

@ -146,6 +146,14 @@ h4 {
}
}
.no-results {
text-align: center;
padding: 40px;
color: $grey;
font-style: italic;
font-size: 1.2rem;
}
.placeholder {
display: inline-block;
height: 1.2em;