Uploads: show placeholder when loading

This commit is contained in:
infinite-persistence 2022-04-04 20:05:46 +08:00 committed by Thomas Zarebczan
parent 2a38f2c177
commit 1e6f64f235

View file

@ -4,6 +4,7 @@ import * as ICONS from 'constants/icons';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import Button from 'component/button'; import Button from 'component/button';
import ClaimList from 'component/claimList'; import ClaimList from 'component/claimList';
import ClaimPreview from 'component/claimPreview';
import Page from 'component/page'; import Page from 'component/page';
import Paginate from 'component/common/paginate'; import Paginate from 'component/common/paginate';
import { PAGE_PARAM, PAGE_SIZE_PARAM } from 'constants/claim'; import { PAGE_PARAM, PAGE_SIZE_PARAM } from 'constants/claim';
@ -106,7 +107,6 @@ function FileListPublished(props: Props) {
} }
headerAltControls={ headerAltControls={
<div className="card__actions--inline"> <div className="card__actions--inline">
{fetching && <Spinner type="small" />}
{!fetching && ( {!fetching && (
<Button <Button
button="alt" button="alt"
@ -125,8 +125,11 @@ function FileListPublished(props: Props) {
</div> </div>
} }
persistedStorageKey="claim-list-published" persistedStorageKey="claim-list-published"
uris={urls} uris={fetching ? [] : urls}
loading={fetching}
/> />
{fetching &&
new Array(Number(pageSize)).fill(1).map((x, i) => <ClaimPreview key={i} placeholder="loading" />)}
<Paginate totalPages={urlTotal > 0 ? Math.ceil(urlTotal / Number(pageSize)) : 1} /> <Paginate totalPages={urlTotal > 0 ? Math.ceil(urlTotal / Number(pageSize)) : 1} />
</> </>
)} )}