mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-28 16:01:26 +00:00
Fix dashboard loading message
This commit is contained in:
parent
225921c0a4
commit
58c06e17c9
2 changed files with 22 additions and 82 deletions
|
@ -3,21 +3,14 @@ import {
|
||||||
connect
|
connect
|
||||||
} from 'react-redux'
|
} from 'react-redux'
|
||||||
import {
|
import {
|
||||||
selectFeaturedUris
|
selectFeaturedUris,
|
||||||
|
selectFetchingFeaturedUris,
|
||||||
} from 'selectors/content'
|
} from 'selectors/content'
|
||||||
import {
|
|
||||||
doSearchContent,
|
|
||||||
} from 'actions/search'
|
|
||||||
import {
|
|
||||||
selectIsSearching,
|
|
||||||
selectSearchQuery,
|
|
||||||
selectCurrentSearchResults,
|
|
||||||
selectSearchActivated,
|
|
||||||
} from 'selectors/search'
|
|
||||||
import DiscoverPage from './view'
|
import DiscoverPage from './view'
|
||||||
|
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
featuredUris: selectFeaturedUris(state),
|
featuredUris: selectFeaturedUris(state),
|
||||||
|
fetchingFeaturedUris: selectFetchingFeaturedUris(state),
|
||||||
})
|
})
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import lbryio from 'lbryio.js';
|
import lbryio from 'lbryio.js';
|
||||||
|
import lbryuri from 'lbryuri'
|
||||||
import FileTile from 'component/fileTile';
|
import FileTile from 'component/fileTile';
|
||||||
import { FileTileStream } from 'component/fileTileStream'
|
import { FileTileStream } from 'component/fileTileStream'
|
||||||
import {ToolTip} from 'component/tooltip.js';
|
import {ToolTip} from 'component/tooltip.js';
|
||||||
|
@ -24,80 +25,26 @@ const FeaturedCategory = (props) => {
|
||||||
|
|
||||||
const DiscoverPage = (props) => {
|
const DiscoverPage = (props) => {
|
||||||
const {
|
const {
|
||||||
featuredUris
|
featuredUris,
|
||||||
|
fetchingFeaturedUris,
|
||||||
} = props
|
} = props
|
||||||
|
const failed = Object.keys(featuredUris).length === 0
|
||||||
|
|
||||||
return <main>{
|
let content
|
||||||
Object.keys(featuredUris).length === 0 ?
|
|
||||||
<div className="empty">Failed to load landing content.</div> :
|
if (fetchingFeaturedUris) content = <div className="empty">Fetching landing content.</div>
|
||||||
<div>
|
if (!fetchingFeaturedUris && failed) content = <div className="empty">Failed to load landing content.</div>
|
||||||
{
|
if (!fetchingFeaturedUris && !failed) {
|
||||||
Object.keys(featuredUris).map((category) => {
|
content = Object.keys(featuredUris).map(category => {
|
||||||
return featuredUris[category].length ?
|
return featuredUris[category].length ?
|
||||||
<FeaturedCategory key={category} category={category} names={featuredUris[category]} /> :
|
<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;
|
export default DiscoverPage;
|
Loading…
Add table
Reference in a new issue