import { Box, Button, Card, CardBody, CardFooter, CardHeader, Heading, Radio, RadioGroup, Stack, Text, } from "@chakra-ui/react"; import { useState } from "react"; export default function (props: { attachment: string; attachment_loading?: boolean; reporter?: { [k: string]: any }; target_ids: number[]; target_usernames: string[]; }) { const targetMap: { [k: number]: string } = {}; const [attachmentReady, setAttachmentReady] = useState( !props.attachment_loading ); const actionMap: { [k: number]: number } = {}; for (let i = 0; i < props.target_ids.length; i++) Object.defineProperty(targetMap, props.target_ids[i], { value: props.target_usernames[i], }); async function recheckAttachment() { const attachmentCheck = await fetch(`/api/uploads/${props.attachment}`, { method: "HEAD", }); setAttachmentReady(attachmentCheck.ok); } return ( Report for {props.target_usernames.toString()} ID(s): {props.target_ids.toString()} {attachmentReady ? ( {props.attachment_loading ? ( ) : ( {(function () { const radioGroups = []; for (let i = 0; i < props.target_ids.length; i++) { radioGroups.push( { Object.defineProperty(actionMap, props.target_ids[i], { value: parseInt(val), }); }} > {props.target_usernames[i]} Ignore Hide from Leaderboards Ban ); } return radioGroups; })()} )} ); }