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 Card from 'component/common/card';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import Yrbl from 'component/yrbl';
|
import Yrbl from 'component/yrbl';
|
||||||
|
import { PURCHASES_PAGE_SIZE } from 'page/library/view';
|
||||||
|
import Spinner from 'component/spinner';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
fetchingFileList: boolean,
|
fetchingFileList: boolean,
|
||||||
|
@ -74,6 +76,7 @@ function FileListDownloaded(props: Props) {
|
||||||
})}
|
})}
|
||||||
onClick={() => setViewMode(VIEW_PURCHASES)}
|
onClick={() => setViewMode(VIEW_PURCHASES)}
|
||||||
/>
|
/>
|
||||||
|
{loading && <Spinner type="small" />}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
titleActions={
|
titleActions={
|
||||||
|
@ -127,7 +130,8 @@ function FileListDownloaded(props: Props) {
|
||||||
{!query && (
|
{!query && (
|
||||||
<Paginate
|
<Paginate
|
||||||
totalPages={Math.ceil(
|
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 Yrbl from 'component/yrbl';
|
||||||
import { useHistory } from 'react-router';
|
import { useHistory } from 'react-router';
|
||||||
|
|
||||||
|
export const PURCHASES_PAGE_SIZE = 10;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
allDownloadedUrlsCount: number,
|
allDownloadedUrlsCount: number,
|
||||||
myPurchases: Array<string>,
|
myPurchases: Array<string>,
|
||||||
fetchingMyPurchases: boolean,
|
fetchingMyPurchases: boolean,
|
||||||
fetchingFileList: boolean,
|
fetchingFileList: boolean,
|
||||||
doPurchaseList: number => void,
|
doPurchaseList: (number, number) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
function LibraryPage(props: Props) {
|
function LibraryPage(props: Props) {
|
||||||
|
@ -24,7 +26,7 @@ function LibraryPage(props: Props) {
|
||||||
const loading = fetchingFileList || fetchingMyPurchases;
|
const loading = fetchingFileList || fetchingMyPurchases;
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
doPurchaseList(page);
|
doPurchaseList(page, PURCHASES_PAGE_SIZE);
|
||||||
}, [doPurchaseList, page]);
|
}, [doPurchaseList, page]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Add table
Reference in a new issue