2018-04-04 12:08:27 -04:00
|
|
|
// @flow
|
2019-06-11 14:10:58 -04:00
|
|
|
import React, { useEffect } from 'react';
|
2018-03-26 14:32:43 -07:00
|
|
|
import Button from 'component/button';
|
2019-06-19 01:05:43 -04:00
|
|
|
import ClaimList from 'component/claimList';
|
2018-03-26 14:32:43 -07:00
|
|
|
import Page from 'component/page';
|
2019-09-23 13:32:38 -04:00
|
|
|
import Paginate from 'component/common/paginate';
|
|
|
|
import { PAGE_SIZE } from 'constants/claim';
|
2019-10-10 20:37:18 -04:00
|
|
|
import WebUploadList from 'component/webUploadList';
|
2019-11-15 15:48:57 -05:00
|
|
|
import Spinner from 'component/spinner';
|
2017-04-23 23:10:45 +07:00
|
|
|
|
2018-04-04 12:08:27 -04:00
|
|
|
type Props = {
|
2018-10-26 00:20:18 -04:00
|
|
|
checkPendingPublishes: () => void,
|
2020-01-07 23:29:01 -06:00
|
|
|
clearPublish: () => void,
|
2019-10-16 18:03:11 -04:00
|
|
|
fetchClaimListMine: () => void,
|
2018-06-13 17:07:06 -04:00
|
|
|
fetching: boolean,
|
2019-09-25 17:37:01 -04:00
|
|
|
urls: Array<string>,
|
|
|
|
urlTotal: ?number,
|
2019-09-23 13:32:38 -04:00
|
|
|
history: { replace: string => void },
|
|
|
|
page: number,
|
2018-04-04 12:08:27 -04:00
|
|
|
};
|
|
|
|
|
2019-06-11 14:10:58 -04:00
|
|
|
function FileListPublished(props: Props) {
|
2020-01-07 23:29:01 -06:00
|
|
|
const { checkPendingPublishes, clearPublish, fetchClaimListMine, fetching, urls, urlTotal } = props;
|
2019-06-11 14:10:58 -04:00
|
|
|
useEffect(() => {
|
2018-10-26 00:20:18 -04:00
|
|
|
checkPendingPublishes();
|
2019-10-16 18:03:11 -04:00
|
|
|
fetchClaimListMine();
|
|
|
|
}, [checkPendingPublishes, fetchClaimListMine]);
|
2017-04-23 23:10:45 +07:00
|
|
|
|
2019-06-11 14:10:58 -04:00
|
|
|
return (
|
2020-01-02 15:36:03 -05:00
|
|
|
<Page>
|
2019-10-10 20:37:18 -04:00
|
|
|
<WebUploadList />
|
2019-11-15 15:48:57 -05:00
|
|
|
{urls && Boolean(urls.length) && (
|
2020-01-02 15:36:03 -05:00
|
|
|
<React.Fragment>
|
2019-06-28 03:33:07 -04:00
|
|
|
<ClaimList
|
2019-07-21 17:31:22 -04:00
|
|
|
header={__('Your Publishes')}
|
2019-06-28 03:33:07 -04:00
|
|
|
loading={fetching}
|
|
|
|
persistedStorageKey="claim-list-published"
|
2019-09-25 17:37:01 -04:00
|
|
|
uris={urls}
|
2020-01-08 18:50:48 -06:00
|
|
|
headerAltControls={
|
|
|
|
<Button button="link" label={__('New Publish')} navigate="/$/publish" onClick={() => clearPublish()} />
|
|
|
|
}
|
2019-06-28 03:33:07 -04:00
|
|
|
/>
|
2019-09-25 17:37:01 -04:00
|
|
|
<Paginate totalPages={Math.ceil(Number(urlTotal) / Number(PAGE_SIZE))} loading={fetching} />
|
2020-01-02 15:36:03 -05:00
|
|
|
</React.Fragment>
|
2019-11-15 15:48:57 -05:00
|
|
|
)}
|
|
|
|
{!(urls && urls.length) && (
|
|
|
|
<React.Fragment>
|
|
|
|
{!fetching ? (
|
|
|
|
<section className="main--empty">
|
|
|
|
<div className=" section--small">
|
|
|
|
<h2 className="section__title--large">{__('Nothing published to LBRY yet.')}</h2>
|
|
|
|
<div className="section__actions">
|
2020-01-07 23:29:01 -06:00
|
|
|
<Button
|
|
|
|
button="primary"
|
|
|
|
navigate="/$/publish"
|
|
|
|
label={__('Publish something new')}
|
|
|
|
onClick={() => clearPublish()}
|
|
|
|
/>
|
2019-11-15 15:48:57 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
) : (
|
|
|
|
<section className="main--empty">
|
|
|
|
<div className=" section--small">
|
|
|
|
<h2 className="section__title--small">
|
|
|
|
{__('Checking your publishes')}
|
|
|
|
<Spinner type="small" />
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
)}
|
|
|
|
</React.Fragment>
|
2019-06-11 14:10:58 -04:00
|
|
|
)}
|
|
|
|
</Page>
|
|
|
|
);
|
2017-05-01 13:26:09 +07:00
|
|
|
}
|
2017-04-23 23:10:45 +07:00
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
export default FileListPublished;
|