import {
Button,
HStack,
Input,
Link,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
Radio,
RadioGroup,
Table,
TableContainer,
Tbody,
Text,
Td,
Th,
Thead,
Tr,
useToast,
} from "@chakra-ui/react";
import { useState } from "react";
export default function (props: { isOpen: boolean; onClose: () => void }) {
const actionMap: { [k: string]: number } = {};
const [rows, setRows] = useState([] as JSX.Element[]);
function addUser(user: string) {
const newRows = [...rows];
newRows.push(
{user} |
Object.defineProperty(actionMap, user, {
value: parseInt(val),
})
}
>
Do Nothing
Hide from Leaderboards
Ban
|
removeUser(user)}>Remove
|
);
}
function removeUser(user: string) {
const newRows = [...rows];
const el = newRows.find((el) => el.key === user);
if (!el) return;
const elIdx = newRows.indexOf(el);
if (elIdx === -1) return;
newRows.splice(elIdx, 1);
setRows(newRows);
delete actionMap[user];
}
function reset() {
(document.getElementById("username") as HTMLInputElement).value = "";
(document.getElementById("evidence") as HTMLInputElement).value = "";
setRows([]);
Object.keys(actionMap).forEach((k) => delete actionMap[k]);
props.onClose();
}
return (
New Game Ban
Username(s)
Username |
Punishment |
Remove |
{rows}
Evidence
);
}