@@ -57,6 +58,10 @@ let WunderBar = React.createClass({
_input: null,
_stateBeforeSearch: null,
+ propTypes: {
+ onSearch: React.PropTypes.func.isRequired
+ },
+
getInitialState: function() {
return {
address: this.props.address,
@@ -77,13 +82,11 @@ let WunderBar = React.createClass({
this.setState({ address: event.target.value })
- //@TODO: Switch to React.js timing
- var searchTerm = event.target.value;
+ let searchTerm = event.target.value;
this._userTypingTimer = setTimeout(() => {
this.props.onSearch(searchTerm);
}, 800); // 800ms delay, tweak for faster/slower
-
},
componentWillReceiveProps(nextProps) {
if (nextProps.viewingPage !== this.props.viewingPage) {
@@ -98,7 +101,8 @@ let WunderBar = React.createClass({
}
// this._input.value = ""; //trigger placeholder
this._focusPending = true;
- if (!this.state.address.startsWith('lbry://')) //onFocus, if they are not on an exact URL, clear the bar
+ //below is hacking, improved when we have proper routing
+ if (!this.state.address.startsWith('lbry://') && this.state.icon !== "icon-search") //onFocus, if they are not on an exact URL or a search page, clear the bar
{
newState.address = '';
}
diff --git a/ui/js/component/load_screen.js b/ui/js/component/load_screen.js
index ad013030c..4f191d891 100644
--- a/ui/js/component/load_screen.js
+++ b/ui/js/component/load_screen.js
@@ -9,9 +9,6 @@ var LoadScreen = React.createClass({
details: React.PropTypes.string,
isWarning: React.PropTypes.bool,
},
- handleCancelClick: function() {
- history.back();
- },
getDefaultProps: function() {
return {
isWarning: false,
@@ -34,9 +31,6 @@ var LoadScreen = React.createClass({
{this.props.isWarning ? : null} {this.props.details}
- {window.history.length > 1
- ?
- : null}
);
diff --git a/ui/js/lbry.js b/ui/js/lbry.js
index c13635a09..356887483 100644
--- a/ui/js/lbry.js
+++ b/ui/js/lbry.js
@@ -31,7 +31,6 @@ function savePendingPublish({name, channel_name}) {
return newPendingPublish;
}
-
/**
* If there is a pending publish with the given name or outpoint, remove it.
* A channel name may also be provided along with name.
@@ -132,6 +131,24 @@ lbry.connect = function() {
return lbry._connectPromise;
}
+
+//kill this but still better than document.title =, which this replaced
+lbry.setTitle = function(title) {
+ document.title = title + " - LBRY";
+}
+
+//kill this with proper routing
+lbry.back = function() {
+ console.log(window.history);
+ if (window.history.length > 1) {
+ console.log('history exists, go back');
+ window.history.back();
+ } else {
+ console.log('no history, reload');
+ window.location.href = "?discover";
+ }
+}
+
lbry.isDaemonAcceptingConnections = function (callback) {
// Returns true/false whether the daemon is at a point it will start returning status
lbry.call('status', {}, () => callback(true), null, () => callback(false))
diff --git a/ui/js/lbryio.js b/ui/js/lbryio.js
index 7a1ab58c2..f37cccf62 100644
--- a/ui/js/lbryio.js
+++ b/ui/js/lbryio.js
@@ -151,20 +151,6 @@ lbryio.authenticate = function() {
} else {
setCurrentUser()
}
- // if (!lbryio._
- //(data) => {
- // resolve(data)
- // localStorage.setItem('accessToken', ID);
- // localStorage.setItem('appId', installation_id);
- // this.setState({
- // registrationCheckComplete: true,
- // justRegistered: true,
- // });
- //});
- // lbryio.call('user_install', 'exists', {app_id: installation_id}).then((userExists) => {
- // // TODO: deal with case where user exists already with the same app ID, but we have no access token.
- // // Possibly merge in to the existing user with the same app ID.
- // })
}).catch(reject);
});
}
diff --git a/ui/js/page/discover.js b/ui/js/page/discover.js
index 3c807e831..d522a99f8 100644
--- a/ui/js/page/discover.js
+++ b/ui/js/page/discover.js
@@ -1,79 +1,18 @@
import React from 'react';
-import lbry from '../lbry.js';
import lbryio from '../lbryio.js';
-import lbryuri from '../lbryuri.js';
-import lighthouse from '../lighthouse.js';
import {FileTile, FileTileStream} from '../component/file-tile.js';
-import {Link} from '../component/link.js';
import {ToolTip} from '../component/tooltip.js';
-import {BusyMessage} from '../component/common.js';
-
-var fetchResultsStyle = {
- color: '#888',
- textAlign: 'center',
- fontSize: '1.2em'
- };
-
-var SearchActive = React.createClass({
- render: function() {
- return (
-
-
-
- );
- }
-});
-
-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 = [],
- seenNames = {}; //fix this when the search API returns claim IDs
-
- for (let {name, claim, claim_id, channel_name, channel_id, txid, nout} of this.props.results) {
- const uri = lbryuri.build({
- channelName: channel_name,
- contentName: name,
- claimId: channel_id || claim_id,
- });
-
- rows.push(
-
- );
- }
- return (
-
{rows}
- );
- }
-});
const communityCategoryToolTipText = ('Community Content is a public space where anyone can share content with the ' +
-'rest of the LBRY community. Bid on the names "one," "two," "three," "four" and ' +
+ 'rest of the LBRY community. Bid on the names "one," "two," "three," "four" and ' +
'"five" to put your content here!');
-var FeaturedCategory = React.createClass({
+let FeaturedCategory = React.createClass({
render: function() {
return (