Skip to content

Commit 07f83fa

Browse files
committed
chore: layout improvement
1 parent 132743a commit 07f83fa

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

web/src/pages/Jurors/DisplayJurors.tsx

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ const DisplayJurors: React.FC<IDisplayJurors> = ({ totalLeaderboardJurors }) =>
4747
...juror,
4848
rank: searchValue ? undefined : jurorSkip + index + 1,
4949
}));
50-
if (!searchValue && order === "asc") {
51-
return baseJurors?.map((juror) => ({
50+
if (!searchValue && order === "asc" && baseJurors) {
51+
return baseJurors.map((juror) => ({
5252
...juror,
5353
rank: totalLeaderboardJurors - (juror.rank || 0) + 1,
5454
}));
@@ -67,15 +67,29 @@ const DisplayJurors: React.FC<IDisplayJurors> = ({ totalLeaderboardJurors }) =>
6767

6868
return (
6969
<>
70-
{!isUndefined(jurors) && jurors.length === 0 ? (
71-
<StyledLabel>No jurors found</StyledLabel>
72-
) : (
70+
{isUndefined(totalLeaderboardJurors) ? (
7371
<>
7472
<ListContainer>
7573
<Header />
76-
{!isUndefined(jurors)
77-
? jurors.map((juror) => <JurorCard key={juror.id} address={juror.id} {...juror} />)
78-
: [...Array(jurorsPerPage)].map((_, i) => <SkeletonDisputeListItem key={i} />)}
74+
{[...Array(jurorsPerPage)].map((_, i) => (
75+
<SkeletonDisputeListItem key={i} />
76+
))}
77+
</ListContainer>
78+
<StyledPagination currentPage={currentPage} numPages={totalPages} callback={handlePageChange} />
79+
</>
80+
) : (
81+
<>
82+
<ListContainer>
83+
{!isUndefined(jurors) && jurors.length === 0 ? (
84+
<StyledLabel>No jurors found</StyledLabel>
85+
) : (
86+
<>
87+
<Header />
88+
{!isUndefined(jurors)
89+
? jurors.map((juror) => <JurorCard key={juror.id} address={juror.id} {...juror} />)
90+
: [...Array(jurorsPerPage)].map((_, i) => <SkeletonDisputeListItem key={i} />)}
91+
</>
92+
)}
7993
</ListContainer>
8094
<StyledPagination currentPage={currentPage} numPages={totalPages} callback={handlePageChange} />
8195
</>

web/src/pages/Jurors/index.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import styled, { css } from "styled-components";
44
import { MAX_WIDTH_LANDSCAPE, landscapeStyle } from "styles/landscapeStyle";
55
import { responsiveSize } from "styles/responsiveSize";
66

7-
import Skeleton from "react-loading-skeleton";
87
import { useAccount } from "wagmi";
98

10-
import { isUndefined } from "utils/index";
11-
129
import { useTotalLeaderboardJurors } from "queries/useTotalLeaderboardJurors";
1310

1411
import ArrowIcon from "svgs/icons/arrow.svg";
@@ -58,18 +55,14 @@ const Jurors: React.FC = () => {
5855
<Header>
5956
<StyledTitle>Jurors Leaderboard</StyledTitle>
6057
{isConnected ? (
61-
<StyledArrowLink to={"/profile/1/desc/all"}>
58+
<StyledArrowLink to="/profile/1/desc/all">
6259
My Profile <ArrowIcon />
6360
</StyledArrowLink>
6461
) : null}
6562
</Header>
6663
<Search />
6764
<StatsAndFilters totalJurors={totalLeaderboardJurors} />
68-
{!isUndefined(totalLeaderboardJurors) && Number(totalLeaderboardJurors) > 0 ? (
69-
<DisplayJurors totalLeaderboardJurors={Number(totalLeaderboardJurors)} />
70-
) : (
71-
<Skeleton height={1000} />
72-
)}
65+
<DisplayJurors totalLeaderboardJurors={totalLeaderboardJurors} />
7366
</Container>
7467
<ScrollTop />
7568
</>

0 commit comments

Comments
 (0)