-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
54 lines (49 loc) · 1.27 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
import { ContentWrapper } from "../components/Layout"
import gql from "graphql-tag"
import { useMostVotedServersQuery } from "../generated/gql-client"
import { Icon, Spinner } from "@blueprintjs/core"
import styled from "styled-components"
import { ServersTable } from "../components/ServersTable"
gql`
query MostVotedServers {
mostVotedServers {
...ServersTableData
}
}
`
const StyledMain = styled.main`
flex: 1;
overflow: auto;
`
const MostVotedServersPage = () => {
const { loading, data } = useMostVotedServersQuery({
fetchPolicy: "cache-and-network",
})
return (
<ContentWrapper centerContent={loading}>
{loading ? (
<Spinner />
) : (
<>
<StyledMain>
<h2 style={{ position: "sticky", left: 0 }}>
<Icon
icon="thumbs-up"
style={{ verticalAlign: "baseline", marginRight: 8 }}
color="gray"
/>
Top Rated Servers
</h2>
{data?.mostVotedServers && (
<ServersTable
servers={data.mostVotedServers}
lastColumn="votes"
/>
)}
</StyledMain>
</>
)}
</ContentWrapper>
)
}
export default MostVotedServersPage