import { Avatar, Box, Grid, GridItem, Text, useColorModeValue } from "@chakra-ui/react"; import { FiChevronDown } from "react-icons/fi"; import { get } from "src/lib/api"; import useSWR from "swr"; /** * Presents a grid of leaderboard entries with more detailed information. */ const LeaderboardGridCell = () => { const { data: leaderboardEntries } = useSWR("/api/leaderboard", get); const backgroundColor = useColorModeValue("white", "gray.800"); const columns = `repeat(${FILTER.length}, 1fr)`; return ( <> {FILTER.map(({ title, GridItemProps }, index) => ( {title} ))} {leaderboardEntries?.map(({ display_name, ranking, score }, index) => ( {display_name} {ranking} {score} {/* {item.medal} */} ))} ); }; /** * Specifies the table headers in the grid. */ const FILTER = [ { title: "User", isActive: false, GridItemProps: { justifyContent: "start" }, }, { title: "Rank", isActive: false, GridItemProps: { justifyContent: "center" }, }, { title: "Score", isActive: false, GridItemProps: { justifyContent: "center" }, }, /* { title: "Medal", isActive: false, GridItemProps: { justifyContent: "center" }, }, */ ]; export { LeaderboardGridCell };