2018-06-13 23:07:06 +02:00
|
|
|
// @flow
|
2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Button from 'component/button';
|
2019-06-19 07:05:43 +02:00
|
|
|
import ClaimList from 'component/claimList';
|
2019-09-23 19:32:38 +02:00
|
|
|
import Paginate from 'component/common/paginate';
|
|
|
|
import { PAGE_SIZE } from 'constants/claim';
|
2017-04-23 18:10:45 +02:00
|
|
|
|
2018-06-13 23:07:06 +02:00
|
|
|
type Props = {
|
|
|
|
fetching: boolean,
|
2019-06-11 20:10:58 +02:00
|
|
|
downloadedUris: Array<string>,
|
2019-09-23 19:32:38 +02:00
|
|
|
downloadedUrisCount: ?number,
|
|
|
|
history: { replace: string => void },
|
|
|
|
page: number,
|
2018-06-13 23:07:06 +02:00
|
|
|
};
|
|
|
|
|
2019-06-11 20:10:58 +02:00
|
|
|
function FileListDownloaded(props: Props) {
|
2019-09-25 23:17:23 +02:00
|
|
|
const { fetching, downloadedUris, downloadedUrisCount } = props;
|
2019-06-11 20:10:58 +02:00
|
|
|
const hasDownloads = !!downloadedUris.length;
|
|
|
|
return (
|
|
|
|
// Removed the <Page> wapper to try combining this page with UserHistory
|
|
|
|
// This should eventually move into /components if we want to keep it this way
|
|
|
|
<React.Fragment>
|
|
|
|
{hasDownloads ? (
|
|
|
|
<div className="card">
|
2019-06-28 09:33:07 +02:00
|
|
|
<ClaimList
|
2019-07-21 23:31:22 +02:00
|
|
|
header={__('Your Library')}
|
2019-06-28 09:33:07 +02:00
|
|
|
defaultSort
|
|
|
|
persistedStorageKey="claim-list-downloaded"
|
|
|
|
uris={downloadedUris}
|
|
|
|
loading={fetching}
|
|
|
|
/>
|
2019-09-25 23:17:23 +02:00
|
|
|
<Paginate totalPages={Math.ceil(Number(downloadedUrisCount) / Number(PAGE_SIZE))} loading={fetching} />
|
2019-06-11 20:10:58 +02:00
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<div className="main--empty">
|
|
|
|
<section className="card card--section">
|
2019-07-21 23:31:22 +02:00
|
|
|
<h2 className="card__title">{__("You haven't downloaded anything from LBRY yet.")}</h2>
|
|
|
|
<div className="card__actions card__actions--center">
|
|
|
|
<Button button="primary" navigate="/" label={__('Explore new content')} />
|
2019-06-11 20:10:58 +02:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</React.Fragment>
|
|
|
|
);
|
2017-04-23 18:10:45 +02:00
|
|
|
}
|
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export default FileListDownloaded;
|