forked from LAION-AI/Open-Assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrollboard.tsx
104 lines (100 loc) · 3.16 KB
/
trollboard.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import {
Box,
Card,
CardBody,
Heading,
Radio,
RadioGroup,
Stack,
Tab,
TabList,
TabPanel,
TabPanels,
Tabs,
useBoolean,
} from "@chakra-ui/react";
import Head from "next/head";
import { useTranslation } from "next-i18next";
import React from "react";
export { getStaticProps } from "src/lib/defaultServerSideProps";
import { AdminArea } from "src/components/AdminArea";
import { AdminLayout } from "src/components/Layout";
import { TrollboardTable } from "src/components/LeaderboardTable/TrollboardTable";
import { TrollboardTimeFrame } from "src/types/Trollboard";
const Leaderboard = () => {
const { t } = useTranslation(["leaderboard", "common"]);
const [enabled, setEnabled] = useBoolean(true);
return (
<>
<Head>
<title>{`Trollboard - ${t("common:title")}`}</title>
<meta name="description" content="Admin Trollboard" charSet="UTF-8" />
</Head>
<AdminArea>
<Box display="flex" flexDirection="column">
<Heading fontSize="2xl" fontWeight="bold" pb="4">
Trollboard
</Heading>
<Card>
<CardBody>
<RadioGroup defaultValue="1" onChange={setEnabled.toggle}>
<Stack direction="row" spacing={5}>
<Radio value="1" colorScheme="green">
Show active users
</Radio>
<Radio value="2" colorScheme="red">
Show banned users
</Radio>
</Stack>
</RadioGroup>
<Tabs isFitted isLazy>
<TabList mb={4}>
<Tab>{t("daily")}</Tab>
<Tab>{t("weekly")}</Tab>
<Tab>{t("monthly")}</Tab>
<Tab>{t("overall")}</Tab>
</TabList>
<TabPanels>
<TabPanel p="0">
<TrollboardTable
timeFrame={TrollboardTimeFrame.day}
limit={100}
rowPerPage={20}
enabled={enabled}
/>
</TabPanel>
<TabPanel p="0">
<TrollboardTable
timeFrame={TrollboardTimeFrame.week}
limit={100}
rowPerPage={20}
enabled={enabled}
/>
</TabPanel>
<TabPanel p="0">
<TrollboardTable
timeFrame={TrollboardTimeFrame.month}
limit={100}
rowPerPage={20}
enabled={enabled}
/>
</TabPanel>
<TabPanel p="0">
<TrollboardTable
timeFrame={TrollboardTimeFrame.total}
limit={100}
rowPerPage={20}
enabled={enabled}
/>
</TabPanel>
</TabPanels>
</Tabs>
</CardBody>
</Card>
</Box>
</AdminArea>
</>
);
};
Leaderboard.getLayout = AdminLayout;
export default Leaderboard;