lbry-desktop/src/ui/page/fileListDownloaded/view.jsx

48 lines
1.6 KiB
React
Raw Normal View History

// @flow
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';
type Props = {
fetching: boolean,
2019-09-25 23:37:01 +02:00
downloadedUrls: Array<string>,
downloadedUrlsCount: ?number,
2019-09-23 19:32:38 +02:00
history: { replace: string => void },
page: number,
};
2019-06-11 20:10:58 +02:00
function FileListDownloaded(props: Props) {
2019-09-25 23:37:01 +02:00
const { fetching, downloadedUrls, downloadedUrlsCount } = props;
const hasDownloads = !!downloadedUrls.length;
2019-06-11 20:10:58 +02:00
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
persistedStorageKey="claim-list-downloaded"
2019-09-25 23:37:01 +02:00
uris={downloadedUrls}
2019-06-28 09:33:07 +02:00
loading={fetching}
/>
2019-09-25 23:37:01 +02:00
<Paginate totalPages={Math.ceil(Number(downloadedUrlsCount) / 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-06-06 06:21:55 +02:00
export default FileListDownloaded;