From 3dfa0ce86dc4b3fecc516cc160c6600408c549e8 Mon Sep 17 00:00:00 2001
From: regalijan <r@regalijan.com>
Date: Thu, 19 Oct 2023 16:50:49 -0400
Subject: [PATCH] Properly clear user list on close

---
 components/NewGameBan.tsx | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/components/NewGameBan.tsx b/components/NewGameBan.tsx
index 4e8e327..6ca125b 100644
--- a/components/NewGameBan.tsx
+++ b/components/NewGameBan.tsx
@@ -20,11 +20,11 @@ import {
   Thead,
   Tr,
   VStack,
-  useToast,
+  useToast
 } from "@chakra-ui/react";
 import { useState } from "react";
 
-export default function (props: { isOpen: boolean; onClose: () => void }) {
+export default function(props: { isOpen: boolean; onClose: () => void }) {
   const actionMap: { [k: string]: number } = {};
   const [users, setUsers] = useState([] as string[]);
   const toast = useToast();
@@ -42,7 +42,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
     png: "image/png",
     webp: "image/webp",
     webm: "video/webm",
-    wmv: "video/x-ms-wmv",
+    wmv: "video/x-ms-wmv"
   };
 
   function addUser(user: string) {
@@ -98,19 +98,19 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
         bypass: true,
         filename: evidence.name,
         filesize: evidence.size,
-        usernames,
+        usernames
       }),
       headers: {
-        "content-type": "application/json",
+        "content-type": "application/json"
       },
-      method: "POST",
+      method: "POST"
     });
 
     if (!submitReq.ok) {
       toast({
         description: ((await submitReq.json()) as { error: string }).error,
         status: "error",
-        title: "Failed to submit report",
+        title: "Failed to submit report"
       });
 
       return;
@@ -125,24 +125,24 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
           evidence.type ||
           fileTypes[
             evidence.name.split(".")[evidence.name.split(".").length - 1]
-          ],
+            ]
       },
-      method: "PUT",
+      method: "PUT"
     });
 
     if (!fileUpload.ok) {
       await fetch("/api/reports/recall", {
         body: JSON.stringify({ id }),
         headers: {
-          "content-type": "application/json",
+          "content-type": "application/json"
         },
-        method: "POST",
+        method: "POST"
       });
 
       toast({
         description: "Failed to upload file",
         status: "error",
-        title: "Error",
+        title: "Error"
       });
 
       return;
@@ -151,15 +151,15 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
     await fetch("/api/reports/complete", {
       body: JSON.stringify({ id }),
       headers: {
-        "content-type": "application/json",
+        "content-type": "application/json"
       },
-      method: "POST",
+      method: "POST"
     });
 
     toast({
       description: "User moderated",
       status: "success",
-      title: "Success",
+      title: "Success"
     });
   }
 
@@ -168,12 +168,12 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
       <ModalOverlay />
       <ModalContent>
         <ModalHeader>New Game Ban</ModalHeader>
-        <ModalCloseButton />
+        <ModalCloseButton onClick={reset} />
         <ModalBody>
           <Text>Username(s)</Text>
           <Input id="username" mb="8px" placeholder="builderman" />
           <Button
-            onClick={function () {
+            onClick={function() {
               const user = (
                 document.getElementById("username") as HTMLInputElement
               ).value;
@@ -191,7 +191,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
                   duration: 5000,
                   isClosable: true,
                   status: "error",
-                  title: "Invalid Username",
+                  title: "Invalid Username"
                 });
                 return;
               }
@@ -220,7 +220,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
                       <RadioGroup
                         onChange={(val) =>
                           Object.defineProperty(actionMap, user, {
-                            value: parseInt(val),
+                            value: parseInt(val)
                           })
                         }
                       >