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

53 lines
1.6 KiB
React
Raw Normal View History

// @flow
2019-06-11 20:10:58 +02:00
import React, { useEffect } 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';
2018-03-26 23:32:43 +02:00
import Page from 'component/page';
2019-09-23 19:32:38 +02:00
import Paginate from 'component/common/paginate';
import { PAGE_SIZE } from 'constants/claim';
type Props = {
2018-10-26 06:20:18 +02:00
checkPendingPublishes: () => void,
fetching: boolean,
2019-09-23 19:32:38 +02:00
uris: Array<string>,
uriTotal: ?number,
history: { replace: string => void },
page: number,
};
2019-06-11 20:10:58 +02:00
function FileListPublished(props: Props) {
2019-09-25 23:17:23 +02:00
const { checkPendingPublishes, fetching, uris, uriTotal } = props;
2019-06-11 20:10:58 +02:00
useEffect(() => {
2018-10-26 06:20:18 +02:00
checkPendingPublishes();
2019-06-11 20:10:58 +02:00
}, [checkPendingPublishes]);
2019-06-11 20:10:58 +02:00
return (
2019-06-11 20:38:08 +02:00
<Page notContained>
{uris && uris.length ? (
2019-06-11 20:10:58 +02:00
<div className="card">
2019-06-28 09:33:07 +02:00
<ClaimList
2019-07-21 23:31:22 +02:00
header={__('Your Publishes')}
2019-06-28 09:33:07 +02:00
loading={fetching}
persistedStorageKey="claim-list-published"
uris={uris}
defaultSort
headerAltControls={<Button button="link" label={__('New Publish')} navigate="/$/publish" />}
/>
2019-09-25 23:17:23 +02:00
<Paginate totalPages={Math.ceil(Number(uriTotal) / 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">{__("It looks like you haven't published anything to LBRY yet.")}</h2>
<div className="card__actions card__actions--center">
<Button button="primary" navigate="/$/publish" label={__('Publish something new')} />
2019-06-11 20:10:58 +02:00
</div>
</section>
</div>
)}
</Page>
);
2017-05-01 08:26:09 +02:00
}
2017-06-06 06:21:55 +02:00
export default FileListPublished;