// @flow import * as PAGES from 'constants/pages'; import * as ICONS from 'constants/icons'; import React, { useEffect } from 'react'; import Button from 'component/button'; import ClaimList from 'component/claimList'; import Page from 'component/page'; import Paginate from 'component/common/paginate'; import { PAGE_PARAM, PAGE_SIZE_PARAM } from 'constants/claim'; import WebUploadList from 'component/webUploadList'; import Spinner from 'component/spinner'; import Yrbl from 'component/yrbl'; import classnames from 'classnames'; const FILTER_ALL = 'stream,repost'; const FILTER_UPLOADS = 'stream'; const FILTER_REPOSTS = 'repost'; type Props = { uploadCount: number, checkPendingPublishes: () => void, clearPublish: () => void, fetchClaimListMine: (number, number, boolean, Array) => void, fetching: boolean, urls: Array, urlTotal: number, history: { replace: (string) => void, push: (string) => void }, page: number, pageSize: number, }; function FileListPublished(props: Props) { const { uploadCount, checkPendingPublishes, clearPublish, fetchClaimListMine, fetching, urls, urlTotal, page, pageSize, } = props; const [filterBy, setFilterBy] = React.useState(FILTER_ALL); const params = {}; params[PAGE_PARAM] = Number(page); params[PAGE_SIZE_PARAM] = Number(pageSize); const paramsString = JSON.stringify(params); useEffect(() => { checkPendingPublishes(); }, [checkPendingPublishes]); useEffect(() => { if (paramsString && fetchClaimListMine) { const params = JSON.parse(paramsString); fetchClaimListMine(params.page, params.page_size, true, filterBy.split(',')); } }, [uploadCount, paramsString, filterBy, fetchClaimListMine]); return (
{!!urls && ( <>
} persistedStorageKey="claim-list-published" uris={urls} /> 0 ? Math.ceil(urlTotal / Number(pageSize)) : 1} /> )} {!(urls && urls.length) && ( {!fetching ? (
) : (
)}
)}
); } export default FileListPublished;