Pusher errors; Right-clickable now playing album; Clickable links fixes #82

This commit is contained in:
James Barnsley
2017-03-22 08:42:26 +13:00
parent b715036776
commit 19323ed645
4 changed files with 35 additions and 4 deletions

View File

@ -304,7 +304,9 @@ class IrisCore(object):
except:
logger.error('IrisFrontend: access_token missing or invalid')
self.broadcast({
'error': 'Could not get radio tracks: access_token missing or invalid'
'type': 'error',
'message': 'Could not get radio tracks: access_token missing or invalid',
'source': 'load_more_tracks'
})
try:
@ -318,6 +320,11 @@ class IrisCore(object):
return uris
except:
logger.error('IrisFrontend: Failed to fetch Spotify recommendations')
self.broadcast({
'type': 'error',
'message': 'Could not get radio tracks',
'source': 'load_more_tracks'
})
return False
@ -329,7 +336,8 @@ class IrisCore(object):
if not uris:
self.broadcast({
'error': 'Could not fetch tracklist length',
'type': 'error',
'message': 'Could not fetch tracklist length',
'source': 'check_for_radio_update'
})
logger.warning('IrisFrontend: Could not fetch tracklist length')

View File

@ -10,6 +10,7 @@ import ArtistSentence from './ArtistSentence'
import Thumbnail from './Thumbnail'
import Dater from './Dater'
import * as uiActions from '../services/ui/actions'
import * as mopidyActions from '../services/mopidy/actions'
class FullPlayer extends React.Component{
@ -18,6 +19,17 @@ class FullPlayer extends React.Component{
super(props);
}
handleContextMenu(e,item){
e.preventDefault()
var data = {
e: e,
context: 'album',
uris: [item.uri],
items: [item]
}
this.props.uiActions.showContextMenu(data)
}
renderPlayButton(){
var button = <a onClick={() => this.props.mopidyActions.play()}><FontAwesome name="play" /> </a>
if( this.props.play_state == 'playing' ){
@ -65,7 +77,7 @@ class FullPlayer extends React.Component{
var link = null
if( this.props.current_track.album.uri ) link = '/album/'+this.props.current_track.album.uri
return (
<Link className="artwork" to={link}>
<Link className="artwork" to={link} onContextMenu={e => this.handleContextMenu(e,this.props.current_track.album)}>
<Thumbnail size="huge" images={this.props.current_track.album.images} canZoom />
</Link>
)
@ -134,6 +146,7 @@ const mapStateToProps = (state, ownProps) => {
const mapDispatchToProps = (dispatch) => {
return {
uiActions: bindActionCreators(uiActions, dispatch),
mopidyActions: bindActionCreators(mopidyActions, dispatch)
}
}

View File

@ -337,6 +337,10 @@ const PusherMiddleware = (function(){
)
break;
case 'PUSHER_ERROR':
store.dispatch(uiActions.createNotification(action.message, 'bad'))
break;
// This action is irrelevant to us, pass it on to the next middleware
default:
return next(action);

View File

@ -905,6 +905,11 @@ export function getPlaylist( uri ){
sendRequest( dispatch, getState, 'users/'+ helpers.getFromUri('userid',uri) +'/playlists/'+ helpers.getFromUri('playlistid',uri) +'?market='+getState().spotify.country )
.then( response => {
// convert links in description
var description = response.description
description = description.replace('<a href="spotify:artist:', '<a href="#'+global.baseURL+'artist/spotify:artist:')
description = description.replace('<a href="spotify:album:', '<a href="#'+global.baseURL+'album/spotify:album:')
var playlist = Object.assign(
{},
response,
@ -912,7 +917,8 @@ export function getPlaylist( uri ){
can_edit: (getState().spotify.me && response.owner.id == getState().spotify.me.id),
tracks: helpers.flattenTracks(response.tracks.items),
tracks_more: response.tracks.next,
tracks_total: response.tracks.total
tracks_total: response.tracks.total,
description: description
}
)