drop down purchases page to 10
This commit is contained in:
parent
4c768b3814
commit
47c19e54ef
2 changed files with 9 additions and 3 deletions
|
@ -12,6 +12,8 @@ import { withRouter } from 'react-router';
|
|||
import Card from 'component/common/card';
|
||||
import classnames from 'classnames';
|
||||
import Yrbl from 'component/yrbl';
|
||||
import { PURCHASES_PAGE_SIZE } from 'page/library/view';
|
||||
import Spinner from 'component/spinner';
|
||||
|
||||
type Props = {
|
||||
fetchingFileList: boolean,
|
||||
|
@ -74,6 +76,7 @@ function FileListDownloaded(props: Props) {
|
|||
})}
|
||||
onClick={() => setViewMode(VIEW_PURCHASES)}
|
||||
/>
|
||||
{loading && <Spinner type="small" />}
|
||||
</div>
|
||||
}
|
||||
titleActions={
|
||||
|
@ -127,7 +130,8 @@ function FileListDownloaded(props: Props) {
|
|||
{!query && (
|
||||
<Paginate
|
||||
totalPages={Math.ceil(
|
||||
Number(viewMode === VIEW_PURCHASES ? myPurchasesCount : downloadedUrlsCount) / Number(PAGE_SIZE)
|
||||
Number(viewMode === VIEW_PURCHASES ? myPurchasesCount : downloadedUrlsCount) /
|
||||
Number(viewMode === VIEW_PURCHASES ? PURCHASES_PAGE_SIZE : PAGE_SIZE)
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
|
|
|
@ -7,12 +7,14 @@ import DownloadList from 'page/fileListDownloaded';
|
|||
import Yrbl from 'component/yrbl';
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
export const PURCHASES_PAGE_SIZE = 10;
|
||||
|
||||
type Props = {
|
||||
allDownloadedUrlsCount: number,
|
||||
myPurchases: Array<string>,
|
||||
fetchingMyPurchases: boolean,
|
||||
fetchingFileList: boolean,
|
||||
doPurchaseList: number => void,
|
||||
doPurchaseList: (number, number) => void,
|
||||
};
|
||||
|
||||
function LibraryPage(props: Props) {
|
||||
|
@ -24,7 +26,7 @@ function LibraryPage(props: Props) {
|
|||
const loading = fetchingFileList || fetchingMyPurchases;
|
||||
|
||||
React.useEffect(() => {
|
||||
doPurchaseList(page);
|
||||
doPurchaseList(page, PURCHASES_PAGE_SIZE);
|
||||
}, [doPurchaseList, page]);
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Reference in a new issue