Streamlining search triggers and sub-views

This commit is contained in:
James Barnsley
2018-01-02 22:55:44 +13:00
parent 8e58d2f868
commit 90eda428c2
6 changed files with 124 additions and 61 deletions

View File

@ -26,8 +26,9 @@ class SearchForm extends React.Component{
}
componentWillReceiveProps(newProps){
if (newProps.query && newProps.query != this.state.query && newProps.query != this.props.query && !this.state.in_focus){
this.setState({query: newProps.query})
if (newProps.query && newProps.query != this.state.query && !this.state.in_focus){
this.setState({query: newProps.query});
console.log(newProps.query);
}
}
@ -50,7 +51,7 @@ class SearchForm extends React.Component{
break
default:
hashHistory.push(global.baseURL+'search/iris:search:'+encodeURIComponent(this.state.query))
hashHistory.push(global.baseURL+'search/search:'+this.props.view+':'+encodeURIComponent(this.state.query));
break
}

View File

@ -16,7 +16,10 @@ export default class URILink extends React.Component{
render(){
var to = null;
var uri = encodeURIComponent(this.props.uri);
var uri = this.props.uri;
if (!this.props.unencoded){
uri = encodeURIComponent(uri);
}
switch (this.props.type){
@ -44,6 +47,10 @@ export default class URILink extends React.Component{
to = global.baseURL+'discover/recommendations/'+uri;
break;
case 'search':
to = global.baseURL+'search/'+uri;
break;
default:
to = null;
}