Pushing to history problematic
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -98,7 +98,7 @@
|
||||
|
||||
// Release details
|
||||
// These are automatically injected to built HTML
|
||||
var build = "1547430384";
|
||||
var build = "1547455694";
|
||||
var version = "3.31.8";
|
||||
|
||||
// Construct the script tag
|
||||
|
||||
@ -44,7 +44,7 @@ class AlbumGrid extends React.Component{
|
||||
type="album"
|
||||
item={album}
|
||||
show_source_icon={this.props.show_source_icon}
|
||||
onClick={e => {history.push(global.baseURL+'album/'+encodeURIComponent(album.uri))}}
|
||||
onClick={e => {history.push(global.baseURL+'album/'+album.uri)}}
|
||||
onContextMenu={e => this.handleContextMenu(e,album)}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -361,6 +361,7 @@ const CoreMiddleware = (function(){
|
||||
break;
|
||||
|
||||
case 'LOAD_ALBUM':
|
||||
console.log(action);
|
||||
|
||||
if (
|
||||
!action.force_reload &&
|
||||
|
||||
@ -29,25 +29,25 @@ class Album extends React.Component{
|
||||
|
||||
componentDidMount(){
|
||||
this.setWindowTitle();
|
||||
this.props.coreActions.loadAlbum(this.props.match.params.uri);
|
||||
this.props.coreActions.loadAlbum(this.props.uri);
|
||||
}
|
||||
|
||||
handleContextMenu(e){
|
||||
e.preventDefault()
|
||||
var data = { uris: [this.props.match.params.uri] }
|
||||
var data = { uris: [this.props.uri] }
|
||||
this.props.uiActions.showContextMenu(e, data, 'album', 'click' )
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps){
|
||||
|
||||
// if our URI has changed, fetch new album
|
||||
if (nextProps.match.params.uri != this.props.match.params.uri){
|
||||
this.props.coreActions.loadAlbum(nextProps.match.params.uri);
|
||||
if (nextProps.uri != this.props.uri){
|
||||
this.props.coreActions.loadAlbum(nextProps.uri);
|
||||
|
||||
// if mopidy has just connected AND we're a local album, go get
|
||||
} else if (!this.props.mopidy_connected && nextProps.mopidy_connected){
|
||||
if (helpers.uriSource(nextProps.match.params.uri) != 'spotify'){
|
||||
this.props.coreActions.loadAlbum(nextProps.match.params.uri);
|
||||
if (helpers.uriSource(nextProps.uri) != 'spotify'){
|
||||
this.props.coreActions.loadAlbum(nextProps.uri);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ class Album extends React.Component{
|
||||
e: e,
|
||||
context: 'album',
|
||||
items: [this.props.album],
|
||||
uris: [this.props.match.params.uri]
|
||||
uris: [this.props.uri]
|
||||
}
|
||||
this.props.uiActions.showContextMenu(data);
|
||||
}
|
||||
@ -98,17 +98,17 @@ class Album extends React.Component{
|
||||
}
|
||||
|
||||
play(){
|
||||
this.props.mopidyActions.playURIs([this.props.match.params.uri], this.props.match.params.uri)
|
||||
this.props.mopidyActions.playURIs([this.props.uri], this.props.uri)
|
||||
}
|
||||
|
||||
inLibrary(){
|
||||
var library = helpers.uriSource(this.props.match.params.uri)+'_library_albums'
|
||||
return (this.props[library] && this.props[library].indexOf(this.props.match.params.uri) > -1)
|
||||
var library = helpers.uriSource(this.props.uri)+'_library_albums'
|
||||
return (this.props[library] && this.props[library].indexOf(this.props.uri) > -1)
|
||||
}
|
||||
|
||||
render(){
|
||||
if (!this.props.album){
|
||||
if (helpers.isLoading(this.props.load_queue,['spotify_albums/'+helpers.getFromUri('albumid',this.props.match.params.uri)])){
|
||||
if (helpers.isLoading(this.props.load_queue,['spotify_albums/'+helpers.getFromUri('albumid',this.props.uri)])){
|
||||
return (
|
||||
<div className="body-loader loading">
|
||||
<div className="loader"></div>
|
||||
@ -152,7 +152,7 @@ class Album extends React.Component{
|
||||
|
||||
<div className="actions">
|
||||
<button className="button button--primary" onClick={e => this.play()}>Play</button>
|
||||
{ helpers.uriSource(this.props.match.params.uri) == 'spotify' ? <FollowButton className="secondary" uri={this.props.match.params.uri} addText="Add to library" removeText="Remove from library" is_following={this.inLibrary()} /> : null }
|
||||
{ helpers.uriSource(this.props.uri) == 'spotify' ? <FollowButton className="secondary" uri={this.props.uri} addText="Add to library" removeText="Remove from library" is_following={this.inLibrary()} /> : null }
|
||||
<ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
|
||||
</div>
|
||||
|
||||
@ -173,6 +173,7 @@ class Album extends React.Component{
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
var uri = ownProps.match.params.uri;
|
||||
return {
|
||||
uri: uri,
|
||||
slim_mode: state.ui.slim_mode,
|
||||
load_queue: state.ui.load_queue,
|
||||
tracks: state.core.tracks,
|
||||
|
||||
Reference in New Issue
Block a user