From aeaed809991c84ea92758ff305161aac93f9edbc Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 20 Jun 2018 02:20:16 -0400 Subject: [PATCH] bump search results to 30 and remove autosearch --- .../component/fileListSearch/index.js | 16 +++++------- .../component/fileListSearch/view.jsx | 25 ------------------- src/renderer/component/wunderbar/index.js | 2 +- src/renderer/page/search/index.js | 10 +++++--- src/renderer/page/search/view.jsx | 20 --------------- 5 files changed, 13 insertions(+), 60 deletions(-) diff --git a/src/renderer/component/fileListSearch/index.js b/src/renderer/component/fileListSearch/index.js index 77ab70d07..5f4011e2d 100644 --- a/src/renderer/component/fileListSearch/index.js +++ b/src/renderer/component/fileListSearch/index.js @@ -1,10 +1,5 @@ import { connect } from 'react-redux'; -import { - doSearch, - makeSelectSearchUris, - selectIsSearching, - selectSearchDownloadUris, -} from 'lbry-redux'; +import { makeSelectSearchUris, selectIsSearching, selectSearchDownloadUris } from 'lbry-redux'; import FileListSearch from './view'; const select = (state, props) => ({ @@ -13,8 +8,9 @@ const select = (state, props) => ({ isSearching: selectIsSearching(state), }); -const perform = dispatch => ({ - search: search => dispatch(doSearch(search)), -}); +const perform = () => ({}); -export default connect(select, perform)(FileListSearch); +export default connect( + select, + perform +)(FileListSearch); diff --git a/src/renderer/component/fileListSearch/view.jsx b/src/renderer/component/fileListSearch/view.jsx index 2831eb970..e77e667df 100644 --- a/src/renderer/component/fileListSearch/view.jsx +++ b/src/renderer/component/fileListSearch/view.jsx @@ -3,14 +3,10 @@ import React from 'react'; import FileTile from 'component/fileTile'; import ChannelTile from 'component/channelTile'; import { parseURI } from 'lbry-redux'; -import debounce from 'util/debounce'; - -const SEARCH_DEBOUNCE_TIME = 800; const NoResults = () =>
{__('No results')}
; type Props = { - search: string => void, query: string, isSearching: boolean, uris: ?Array, @@ -18,27 +14,6 @@ type Props = { }; class FileListSearch extends React.PureComponent { - constructor(props: Props) { - super(props); - this.debouncedSearch = debounce(this.props.search, SEARCH_DEBOUNCE_TIME); - } - - componentDidMount() { - const { search, query } = this.props; - search(query); - } - - componentWillReceiveProps(nextProps: Props) { - const { query: nextQuery } = nextProps; - const { query: currentQuerry } = this.props; - - if (nextQuery !== currentQuerry) { - this.debouncedSearch(nextQuery); - } - } - - debouncedSearch: string => void; - render() { const { uris, query, downloadUris, isSearching } = this.props; diff --git a/src/renderer/component/wunderbar/index.js b/src/renderer/component/wunderbar/index.js index 9aa3778ea..2332fc81a 100644 --- a/src/renderer/component/wunderbar/index.js +++ b/src/renderer/component/wunderbar/index.js @@ -26,7 +26,7 @@ const select = state => { const perform = dispatch => ({ onSearch: query => { - dispatch(doSearch(query)); + dispatch(doSearch(query, 30)); // Hard coding this for now until https://github.com/lbryio/lbry-app/pull/1639 is merged dispatch(doNavigate(`/search`, { query })); }, onSubmit: (uri, extraParams) => dispatch(doNavigate('/show', { uri, ...extraParams })), diff --git a/src/renderer/page/search/index.js b/src/renderer/page/search/index.js index 75d1f6b00..f640f75f0 100644 --- a/src/renderer/page/search/index.js +++ b/src/renderer/page/search/index.js @@ -1,12 +1,11 @@ -import React from 'react'; import { connect } from 'react-redux'; -import { selectIsSearching, selectSearchValue, doUpdateSearchQuery } from 'lbry-redux'; +import { selectIsSearching, doUpdateSearchQuery, makeSelectCurrentParam } from 'lbry-redux'; import { doNavigate } from 'redux/actions/navigation'; import SearchPage from './view'; const select = state => ({ isSearching: selectIsSearching(state), - query: selectSearchValue(state), + query: makeSelectCurrentParam('query')(state), }); const perform = dispatch => ({ @@ -14,4 +13,7 @@ const perform = dispatch => ({ updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)), }); -export default connect(select, perform)(SearchPage); +export default connect( + select, + perform +)(SearchPage); diff --git a/src/renderer/page/search/view.jsx b/src/renderer/page/search/view.jsx index b0127a7d9..b28882adc 100644 --- a/src/renderer/page/search/view.jsx +++ b/src/renderer/page/search/view.jsx @@ -8,31 +8,11 @@ import Page from 'component/page'; import Icon from 'component/common/icon'; import * as icons from 'constants/icons'; -const MODAL_ANIMATION_TIME = 250; - type Props = { query: ?string, }; class SearchPage extends React.PureComponent { - constructor() { - super(); - - this.input = null; - } - - componentDidMount() { - // Wait for the modal to animate down before focusing - // without this there is an issue with scroll the page down - setTimeout(() => { - if (this.input) { - this.input.focus(); - } - }, MODAL_ANIMATION_TIME); - } - - input: ?HTMLInputElement; - render() { const { query } = this.props; return (