-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathindex.tsx
66 lines (53 loc) · 1.66 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React from "react";
import styled, { css } from "styled-components";
import { isUndefined } from "utils/index";
import { useJurorsByCoherenceScore } from "queries/useJurorsByCoherenceScore";
import { landscapeStyle } from "styles/landscapeStyle";
import { responsiveSize } from "styles/responsiveSize";
import { SkeletonDisputeListItem } from "components/StyledSkeleton";
import Header from "./Header";
import JurorCard from "./JurorCard";
const Container = styled.div`
margin-top: ${responsiveSize(24, 48)};
`;
const Title = styled.h1`
margin-bottom: ${responsiveSize(12, 24)};
font-size: ${responsiveSize(20, 24)};
`;
export const ListContainer = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
${landscapeStyle(
() => css`
display: grid;
grid-template-columns: 1fr;
`
)}
`;
export const StyledLabel = styled.label`
font-size: 16px;
`;
const TopJurors: React.FC = () => {
const { data: queryJurors } = useJurorsByCoherenceScore(0, 5, "coherenceScore", "desc");
const topJurors = queryJurors?.users?.map((juror, index) => ({
...juror,
rank: index + 1,
}));
return (
<Container>
<Title>Top Jurors</Title>
{!isUndefined(topJurors) && topJurors.length === 0 ? (
<StyledLabel>There are no jurors staked yet.</StyledLabel>
) : (
<ListContainer>
<Header />
{!isUndefined(topJurors)
? topJurors.map((juror) => <JurorCard key={juror.rank} address={juror.id} {...juror} />)
: [...Array(5)].map((_, i) => <SkeletonDisputeListItem key={i} />)}
</ListContainer>
)}
</Container>
);
};
export default TopJurors;