Mopidy results first

This commit is contained in:
James Barnsley
2017-09-05 15:47:35 +12:00
2 changed files with 13 additions and 12 deletions

View File

@ -147,6 +147,7 @@ export default function reducer(mopidy = {}, action){
**/ **/
case 'MOPIDY_CLEAR_SEARCH_RESULTS': case 'MOPIDY_CLEAR_SEARCH_RESULTS':
console.log(action)
return Object.assign({}, mopidy, { search_results: {} }); return Object.assign({}, mopidy, { search_results: {} });
case 'MOPIDY_SEARCH_RESULTS_LOADED': case 'MOPIDY_SEARCH_RESULTS_LOADED':

View File

@ -77,36 +77,36 @@ class Search extends React.Component{
var spotify_search_enabled = (this.props.search_settings && this.props.search_settings.spotify) var spotify_search_enabled = (this.props.search_settings && this.props.search_settings.spotify)
var artists = [] var artists = []
if (this.props.spotify_search_results.artists){
artists = [...artists, ...helpers.getIndexedRecords(this.props.artists,this.props.spotify_search_results.artists)]
}
if (this.props.mopidy_search_results.artists){ if (this.props.mopidy_search_results.artists){
artists = [...artists, ...helpers.getIndexedRecords(this.props.artists,this.props.mopidy_search_results.artists)] artists = [...artists, ...helpers.getIndexedRecords(this.props.artists,this.props.mopidy_search_results.artists)]
} }
if (this.props.spotify_search_results.artists){
artists = [...artists, ...helpers.getIndexedRecords(this.props.artists,this.props.spotify_search_results.artists)]
}
var albums = [] var albums = []
if (this.props.spotify_search_results.albums){
albums = [...albums, ...helpers.getIndexedRecords(this.props.albums,this.props.spotify_search_results.albums)]
}
if (this.props.mopidy_search_results.albums){ if (this.props.mopidy_search_results.albums){
albums = [...albums, ...helpers.getIndexedRecords(this.props.albums,this.props.mopidy_search_results.albums)] albums = [...albums, ...helpers.getIndexedRecords(this.props.albums,this.props.mopidy_search_results.albums)]
} }
if (this.props.spotify_search_results.albums){
albums = [...albums, ...helpers.getIndexedRecords(this.props.albums,this.props.spotify_search_results.albums)]
}
var playlists = [] var playlists = []
if (this.props.spotify_search_results.playlists){
playlists = [...playlists, ...helpers.getIndexedRecords(this.props.playlists,this.props.spotify_search_results.playlists)]
}
if (this.props.mopidy_search_results.playlists){ if (this.props.mopidy_search_results.playlists){
playlists = [...playlists, ...helpers.getIndexedRecords(this.props.playlists,this.props.mopidy_search_results.playlists)] playlists = [...playlists, ...helpers.getIndexedRecords(this.props.playlists,this.props.mopidy_search_results.playlists)]
} }
if (this.props.spotify_search_results.playlists){
playlists = [...playlists, ...helpers.getIndexedRecords(this.props.playlists,this.props.spotify_search_results.playlists)]
}
var tracks = [] var tracks = []
if (this.props.spotify_search_results.tracks){
tracks = [...tracks, ...this.props.spotify_search_results.tracks]
}
if (this.props.mopidy_search_results.tracks){ if (this.props.mopidy_search_results.tracks){
tracks = [...tracks, ...this.props.mopidy_search_results.tracks] tracks = [...tracks, ...this.props.mopidy_search_results.tracks]
} }
if (this.props.spotify_search_results.tracks){
tracks = [...tracks, ...this.props.spotify_search_results.tracks]
}
switch (this.props.view){ switch (this.props.view){