diff --git a/pages/mod-queue.page.tsx b/pages/mod-queue.page.tsx index a145910..59edd56 100644 --- a/pages/mod-queue.page.tsx +++ b/pages/mod-queue.page.tsx @@ -7,17 +7,24 @@ import { useToast, VStack, } from "@chakra-ui/react"; -import { useEffect, useState } from "react"; +import { lazy, useState } from "react"; +const AppealCard = lazy(() => import("../components/AppealCard")); export function Page(pageProps: { [p: string]: any }) { const isDesktop = useBreakpointValue({ base: false, lg: true }); const entryTypes = []; + const [entries, setEntries] = useState([] as JSX.Element[]); for (const type of pageProps.entry_types) - entryTypes.push() + entryTypes.push(); - async function updateQueue(queue_type: string, include_closed: boolean = false): Promise { - const queueReq = await fetch(`/api/mod-queue/list?type=${queue_type}&includeClosed=${include_closed}`); + async function updateQueue( + queue_type: string, + show_closed: boolean = false + ): Promise { + const queueReq = await fetch( + `/api/mod-queue/list?type=${queue_type}&showClosed=${show_closed}` + ); if (!queueReq.ok) { const errorData: { error: string } = await queueReq.json(); @@ -32,15 +39,37 @@ export function Page(pageProps: { [p: string]: any }) { return; } + + const entryData: { [k: string]: any }[] = await queueReq.json(); + const newEntries = []; + + for (const entry of entryData) { + switch (queue_type) { + case "appeal": + newEntries.push( + + ); + } + } + + setEntries(newEntries); } return ( - - - - + {entries} +