From 342cbc0337c8ce70fa0c788398c31404900f7f28 Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:49:08 -0400 Subject: [PATCH] Create appeal card generation --- pages/mod-queue.page.tsx | 45 +++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) 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} +