Fix dashboard loading message

This commit is contained in:
6ea86b96 2017-05-07 14:39:13 +07:00
parent 225921c0a4
commit 58c06e17c9
No known key found for this signature in database
GPG key ID: B282D183E4931E8F
2 changed files with 22 additions and 82 deletions

View file

@ -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) => ({

View file

@ -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 <main>{
Object.keys(featuredUris).length === 0 ?
<div className="empty">Failed to load landing content.</div> :
<div>
{
Object.keys(featuredUris).map((category) => {
let content
if (fetchingFeaturedUris) content = <div className="empty">Fetching landing content.</div>
if (!fetchingFeaturedUris && failed) content = <div className="empty">Failed to load landing content.</div>
if (!fetchingFeaturedUris && !failed) {
content = Object.keys(featuredUris).map(category => {
return featuredUris[category].length ?
<FeaturedCategory key={category} category={category} names={featuredUris[category]} /> :
'';
})
}
</div>
}</main>
return (
<main>{content}</main>
)
}
//
// 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 <main>{
// this.state.failed ?
// <div className="empty">Failed to load landing content.</div> :
// <div>
// {
// Object.keys(this.state.featuredUris).map((category) => {
// return this.state.featuredUris[category].length ?
// <FeaturedCategory key={category} category={category} names={this.state.featuredUris[category]} /> :
// '';
// })
// }
// </div>
// }</main>;
// }
// })
// const DiscoverPage = (props) => {
// const {
// isSearching,
// query,
// results,
// searchActive,
// } = props
//
// return (
// <main>
// { (!searchActive || (!isSearching && !query)) && <FeaturedContent {...props} /> }
// { searchActive && isSearching ? <SearchActive /> : null }
// { searchActive && !isSearching && query && results.length ? <SearchResults results={results} /> : null }
// { searchActive && !isSearching && query && !results.length ? <SearchNoResults query={query} /> : null }
// </main>
// );
// }
export default DiscoverPage;