Merge pull request #114 from lbryio/fix-dewey-decimals

Restore Dewey Decimals message in searches
This commit is contained in:
Jeremy Kauffman 2017-01-02 11:26:38 -05:00 committed by GitHub
commit fa469253a3
2 changed files with 20 additions and 13 deletions

View file

@ -40,7 +40,7 @@ var App = React.createClass({
return {
viewingPage: viewingPage,
drawerOpen: drawerOpenRaw !== null ? JSON.parse(drawerOpenRaw) : true,
pageArgs: val,
pageArgs: typeof val !== 'undefined' ? val : null,
errorInfo: null,
modal: null,
startNotice: null,
@ -196,7 +196,7 @@ var App = React.createClass({
return <DeveloperPage />;
case 'discover':
default:
return <DiscoverPage query={this.state.pageArgs} />;
return <DiscoverPage {... this.state.pageArgs !== null ? {query: this.state.pageArgs} : {} } />;
}
},
render: function() {

View file

@ -2,7 +2,7 @@ import React from 'react';
import lbry from '../lbry.js';
import lighthouse from '../lighthouse.js';
import {Link, ToolTipLink, DownloadLink, WatchLink} from '../component/link.js';
import {Thumbnail, CreditAmount, TruncatedText} from '../component/common.js';
import {Thumbnail, CreditAmount, TruncatedText, BusyMessage} from '../component/common.js';
var fetchResultsStyle = {
color: '#888',
@ -268,20 +268,27 @@ var DiscoverPage = React.createClass({
componentDidUpdate: function() {
if (this.props.query != this.state.query)
{
this.handleSearchChanged();
this.handleSearchChanged(this.props.query);
}
},
handleSearchChanged: function() {
this.setState({
searching: true,
query: this.props.query,
});
lighthouse.search(this.props.query, this.searchCallback);
componentWillReceiveProps: function(nextProps, nextState) {
if (nextProps.query != nextState.query)
{
this.handleSearchChanged(nextProps.query);
}
},
componentDidMount: function() {
handleSearchChanged: function(query) {
this.setState({
searching: true,
query: query,
});
lighthouse.search(query, this.searchCallback);
},
componentWillMount: function() {
document.title = "Discover";
if (this.props.query) {
// Rendering with a query already typed
@ -293,7 +300,7 @@ var DiscoverPage = React.createClass({
return {
results: [],
query: this.props.query,
searching: this.props.query && this.props.query.length > 0
searching: ('query' in this.props) && (this.props.query.length > 0)
};
},