diff --git a/website/src/components/Dashboard/LeaderboardTable.tsx b/website/src/components/Dashboard/LeaderboardTable.tsx index b6048f3f..52cf762b 100644 --- a/website/src/components/Dashboard/LeaderboardTable.tsx +++ b/website/src/components/Dashboard/LeaderboardTable.tsx @@ -1,17 +1,16 @@ -import { Box, Link, Stack, StackDivider, Text, useColorModeValue } from "@chakra-ui/react"; +import { Box, Link, Text, useColorModeValue } from "@chakra-ui/react"; import NextLink from "next/link"; -import { get } from "src/lib/api"; -import useSWR from "swr"; +import { LeaderboardGridCell } from "src/components/LeaderboardGridCell"; +import { LeaderboardTimeFrame } from "src/types/Leaderboard"; export function LeaderboardTable() { const backgroundColor = useColorModeValue("white", "gray.700"); const accentColor = useColorModeValue("gray.200", "gray.900"); - const { data: leaderboardEntries } = useSWR("/api/leaderboard", get); return (
- Top 5 Contributors + Top 5 Contributors Today View All -> @@ -25,30 +24,7 @@ export function LeaderboardTable() { borderRadius="xl" className="p-6 shadow-sm" > - } spacing="4"> -
-

Name

-
-

Score

-
-
- {leaderboardEntries?.map(({ display_name, score }, idx) => ( -
-
- {/* - Profile Picture - */} -

{display_name}

- {/* - {item.streakCount} - */} -
- -

{score}

-
-
- ))} -
+
diff --git a/website/src/pages/api/leaderboard.ts b/website/src/pages/api/leaderboard.ts index 10a9a3a7..592f3da5 100644 --- a/website/src/pages/api/leaderboard.ts +++ b/website/src/pages/api/leaderboard.ts @@ -6,7 +6,7 @@ import { LeaderboardTimeFrame } from "src/types/Leaderboard"; * Returns the set of valid labels that can be applied to messages. */ const handler = withoutRole("banned", async (req, res) => { - const time_frame = req.query.time_frame as LeaderboardTimeFrame; + const time_frame = (req.query.time_frame as LeaderboardTimeFrame) || LeaderboardTimeFrame.day; const { leaderboard } = await oasstApiClient.fetch_leaderboard(time_frame); res.status(200).json(leaderboard); });