diff --git a/ui/js/page/discover/index.js b/ui/js/page/discover/index.js index 5a1c14328..47713f5e7 100644 --- a/ui/js/page/discover/index.js +++ b/ui/js/page/discover/index.js @@ -3,21 +3,14 @@ import { connect } from 'react-redux' import { - selectFeaturedUris + selectFeaturedUris, + selectFetchingFeaturedUris, } from 'selectors/content' -import { - doSearchContent, -} from 'actions/search' -import { - selectIsSearching, - selectSearchQuery, - selectCurrentSearchResults, - selectSearchActivated, -} from 'selectors/search' import DiscoverPage from './view' const select = (state) => ({ featuredUris: selectFeaturedUris(state), + fetchingFeaturedUris: selectFetchingFeaturedUris(state), }) const perform = (dispatch) => ({ diff --git a/ui/js/page/discover/view.jsx b/ui/js/page/discover/view.jsx index d476f8780..07d1823d5 100644 --- a/ui/js/page/discover/view.jsx +++ b/ui/js/page/discover/view.jsx @@ -1,5 +1,6 @@ import React from 'react'; import lbryio from 'lbryio.js'; +import lbryuri from 'lbryuri' import FileTile from 'component/fileTile'; import { FileTileStream } from 'component/fileTileStream' import {ToolTip} from 'component/tooltip.js'; @@ -24,80 +25,26 @@ const FeaturedCategory = (props) => { const DiscoverPage = (props) => { const { - featuredUris + featuredUris, + fetchingFeaturedUris, } = props + const failed = Object.keys(featuredUris).length === 0 - return
{ - Object.keys(featuredUris).length === 0 ? -
Failed to load landing content.
: -
- { - Object.keys(featuredUris).map((category) => { - return featuredUris[category].length ? - : - ''; - }) - } -
- }
+ let content + + if (fetchingFeaturedUris) content =
Fetching landing content.
+ if (!fetchingFeaturedUris && failed) content =
Failed to load landing content.
+ if (!fetchingFeaturedUris && !failed) { + content = Object.keys(featuredUris).map(category => { + return featuredUris[category].length ? + : + ''; + }) + } + + return ( +
{content}
+ ) } -// -// let DiscoverPage = React.createClass({ -// getInitialState: function() { -// return { -// featuredUris: {}, -// failed: false -// }; -// }, -// componentWillMount: function() { -// lbryio.call('discover', 'list', { version: "early-access" } ).then(({Categories, Uris}) => { -// let featuredUris = {} -// Categories.forEach((category) => { -// if (Uris[category] && Uris[category].length) { -// featuredUris[category] = Uris[category] -// } -// }) -// this.setState({ featuredUris: featuredUris }); -// }, () => { -// this.setState({ -// failed: true -// }) -// }); -// }, -// render: function() { -// return
{ -// this.state.failed ? -//
Failed to load landing content.
: -//
-// { -// Object.keys(this.state.featuredUris).map((category) => { -// return this.state.featuredUris[category].length ? -// : -// ''; -// }) -// } -//
-// }
; -// } -// }) - -// const DiscoverPage = (props) => { -// const { -// isSearching, -// query, -// results, -// searchActive, -// } = props -// -// return ( -//
-// { (!searchActive || (!isSearching && !query)) && } -// { searchActive && isSearching ? : null } -// { searchActive && !isSearching && query && results.length ? : null } -// { searchActive && !isSearching && query && !results.length ? : null } -//
-// ); -// } - export default DiscoverPage; \ No newline at end of file