import {
Alert,
AlertDescription,
AlertIcon,
AlertTitle,
Box,
Button,
Container,
Flex,
Heading,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
Spacer,
Text,
Textarea,
useDisclosure,
useToast,
} from "@chakra-ui/react";
import { useState } from "react";
import Login from "../components/Login";
import Success from "../components/Success";
export function Page(pageProps: { [p: string]: any }) {
if (!pageProps.logged_in) return ;
const { isOpen, onClose, onOpen } = useDisclosure();
const [showSuccess, setShowSuccess] = useState(false);
const toast = useToast();
async function submit() {
const learned = (document.getElementById("learned") as HTMLInputElement)
.value;
const whyBanned = (document.getElementById("whyBanned") as HTMLInputElement)
.value;
const whyUnban = (document.getElementById("whyUnban") as HTMLInputElement)
.value;
const submitReq = await fetch("/api/appeals/submit", {
body: JSON.stringify({
learned,
whyBanned,
whyUnban,
}),
headers: {
"content-type": "application/json",
},
method: "POST",
}).catch(() => {});
if (!submitReq)
return toast({
description: "Please check your internet and try again",
duration: 10000,
isClosable: true,
status: "error",
title: "Request Failed",
});
if (!submitReq.ok)
return toast({
description: ((await submitReq.json()) as { error: string }).error,
duration: 10000,
isClosable: true,
status: "error",
title: "Error",
});
setShowSuccess(true);
}
async function toggle(active: boolean) {
const toggleReq = await fetch("/api/appeals/toggle", {
body: JSON.stringify({ active }),
headers: {
"content-type": "application/json",
},
method: "POST",
});
if (!toggleReq.ok)
return toast({
description: ((await toggleReq.json()) as { error: string }).error,
duration: 10000,
isClosable: true,
status: "error",
title: "Error",
});
toast({
description: `The appeals form is now ${active ? "opened" : "closed"}.`,
isClosable: true,
status: "success",
title: `Appeals ${active ? "enabled" : "disabled"}`,
});
onClose();
await new Promise((p) => setTimeout(p, 5000));
}
return showSuccess ? (
) : (
Appeals Closed
We are currently not accepting appeals.
Toggle appeals?
Are you sure you want to{" "}
{pageProps.disabled ? "enable" : "disable"} appeals?
Discord Appeals
This is for Discord bans only! See the support page if you were banned
from the game.
Why were you banned?
Why should we unban you?
What have you learned from your mistake?
);
}