var fetchResultsStyle = { color: '#888', textAlign: 'center', fontSize: '1.2em' }; var SearchActive = React.createClass({ render: function() { return (
Looking up the Dewey Decimals
); } }); var searchNoResultsStyle = { textAlign: 'center' }, searchNoResultsMessageStyle = { fontStyle: 'italic', marginRight: '5px' }; var SearchNoResults = React.createClass({ render: function() { return (
No one has checked anything in for {this.props.query} yet.
); } }); var SearchResults = React.createClass({ render: function() { var rows = []; this.props.results.forEach(function(result) { rows.push( ); }); return (
{rows}
); } }); var searchRowStyle = { height: '160px', overflowY: 'hidden' }, searchRowImgStyle = { maxWidth: '100%', maxHeight: '16 0px', display: 'block', marginLeft: 'auto', marginRight: 'auto', float: 'left' }, searchRowTitleStyle = { fontWeight: 'bold' }, searchRowCostStyle = { float: 'right', }, searchRowDescriptionStyle = { color : '#444', marginBottom: '24px', marginTop: '12px', fontSize: '0.9em' }; var SearchResultRow = React.createClass({ getInitialState: function() { return { downloading: false } }, render: function() { return (
{'Photo
lbry://{this.props.name}

{this.props.title}

{this.props.description}

); } }); var FeaturedContentItem = React.createClass({ propTypes: { name: React.PropTypes.string, }, getInitialState: function() { return { metadata: null, title: null, amount: 0.0, }; }, componentWillMount: function() { lbry.resolveName(this.props.name, (metadata) => { this.setState({ metadata: metadata, title: metadata && metadata.title ? metadata.title : ('lbry://' + this.props.name), }) }); lbry.getCostEstimate(this.props.name, (amount) => { this.setState({ amount: amount, }); }); }, render: function() { if (this.state.metadata == null) { // Still waiting for metadata return null; } return ; } }); var featuredContentLegendStyle = { fontSize: '12px', color: '#aaa', verticalAlign: '15%', }; var FeaturedContent = React.createClass({ render: function() { return (

Featured Content

Community Content

); } }); var DiscoverPage = React.createClass({ userTypingTimer: null, componentDidUpdate: function() { if (this.props.query) { lbry.search(this.props.query, this.searchCallback); } }, componentDidMount: function() { document.title = "Discover"; }, getInitialState: function() { return { results: [], query: this.props.query, searching: this.props.query && this.props.query.length > 0 }; }, searchCallback: function(results) { console.log('search callback'); console.log(this.state); console.log(this.props); if (this.state.searching) //could have canceled while results were pending, in which case nothing to do { this.setState({ results: results, searching: false //multiple searches can be out, we're only done if we receive one we actually care about }); } }, render: function() { return (
{ this.state.searching ? : null } { !this.state.searching && this.props.query && this.state.results.length ? : null } { !this.state.searching && this.props.query && !this.state.results.length ? : null } { !this.props.query && !this.state.searching ? : null }
); } });