Search
This commit is contained in:
@ -13,6 +13,7 @@ import ArtistGrid from '../components/ArtistGrid'
|
||||
import AlbumGrid from '../components/AlbumGrid'
|
||||
import PlaylistGrid from '../components/PlaylistGrid'
|
||||
import LazyLoadListener from '../components/LazyLoadListener'
|
||||
import SearchForm from '../components/SearchForm'
|
||||
|
||||
import * as helpers from '../helpers'
|
||||
import * as uiActions from '../services/ui/actions'
|
||||
@ -26,18 +27,26 @@ class Search extends React.Component{
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
this.props.uiActions.startSearch(this.props.params.type, this.props.params.query)
|
||||
|
||||
// Make sure we have search parameters to start with
|
||||
if (this.props.params && this.props.params.type && this.props.params.query){
|
||||
this.props.uiActions.startSearch(this.props.params.type, this.props.params.query)
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps){
|
||||
|
||||
// Make sure we have some search parameters
|
||||
if (newProps.params && newProps.params.type && newProps.params.query){
|
||||
|
||||
if (this.props.params.query != newProps.params.query || this.props.params.type != newProps.params.type){
|
||||
this.props.uiActions.startSearch(newProps.params.type, newProps.params.query)
|
||||
}
|
||||
if (this.props.params.query != newProps.params.query || this.props.params.type != newProps.params.type){
|
||||
this.props.uiActions.startSearch(newProps.params.type, newProps.params.query)
|
||||
}
|
||||
|
||||
// mopidy comes online
|
||||
if (!this.props.mopidy_connected && newProps.mopidy_connected){
|
||||
this.props.uiActions.startSearch(newProps.params.type, newProps.params.query, true)
|
||||
// mopidy comes online
|
||||
if (!this.props.mopidy_connected && newProps.mopidy_connected){
|
||||
this.props.uiActions.startSearch(newProps.params.type, newProps.params.query, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,7 +243,7 @@ class Search extends React.Component{
|
||||
|
||||
return (
|
||||
<div className="view search-view">
|
||||
<Header icon="search" title="Search results" options={options} uiActions={this.props.uiActions} />
|
||||
<Header search options={options} uiActions={this.props.uiActions} />
|
||||
<div className="content-wrapper">
|
||||
{ this.renderResults() }
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user