move fetching logic to page component

This commit is contained in:
Travis Eden 2018-06-19 14:22:13 -04:00 committed by Sean Yesmunt
parent e5f6acc5ae
commit 49700d5906
2 changed files with 5 additions and 9 deletions

View file

@ -13,13 +13,11 @@ type Props = {
class FileListDownloaded extends React.PureComponent<Props> { class FileListDownloaded extends React.PureComponent<Props> {
render() { render() {
const { fetching, fileInfos, navigate } = this.props; const { fetching, fileInfos, navigate } = this.props;
const hasDownloads = fileInfos && fileInfos.length > 0; const hasDownloads = fileInfos && Object.values(fileInfos).length > 0;
return ( return (
<Page notContained> <Page notContained loading={fetching}>
{fetching ? ( {hasDownloads ? (
<div className="card__actions card__actions--center">Fetching content...</div>
) : hasDownloads ? (
<FileList fileInfos={fileInfos} /> <FileList fileInfos={fileInfos} />
) : ( ) : (
<div className="page__empty"> <div className="page__empty">

View file

@ -24,10 +24,8 @@ class FileListPublished extends React.PureComponent<Props> {
const { fetching, claims, navigate } = this.props; const { fetching, claims, navigate } = this.props;
return ( return (
<Page notContained> <Page notContained loading={fetching}>
{fetching ? ( {claims && claims.length ? (
<div className="card__actions card__actions--center">Fetching content...</div>
) : claims.length ? (
<FileList checkPending fileInfos={claims} sortByHeight /> <FileList checkPending fileInfos={claims} sortByHeight />
) : ( ) : (
<div className="page__empty"> <div className="page__empty">