Fix buttons and invert attachment loading check

This commit is contained in:
regalijan 2023-10-19 16:49:24 -04:00
parent 35702eb26d
commit 952cad9bc0
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -40,7 +40,7 @@ export default function (props: {
}
return (
<Card>
<Card w="100%">
<CardHeader>
<Heading size="lg">
Report for {props.target_usernames.toString()}
@ -49,9 +49,9 @@ export default function (props: {
</CardHeader>
<CardBody>
{attachmentReady ? (
<Text>Attachment processing...</Text>
) : (
<video src={`/api/uploads/${props.attachment}`} width="100%" />
) : (
<Text>Attachment processing...</Text>
)}
</CardBody>
<CardFooter>
@ -64,31 +64,36 @@ export default function (props: {
</Button>
) : (
<Stack direction="column">
{Object.entries(targetMap).map(([id, username]) => {
return (
<RadioGroup
name={id}
onChange={(val) =>
Object.defineProperty(actionMap, parseInt(id), {
value: parseInt(val),
})
}
>
<Stack direction="row">
<Text>{username}</Text>
<Radio key={0} value="0">
Ignore
</Radio>
<Radio key={1} value="1">
Hide from Leaderboards
</Radio>
<Radio key={2} value="2">
Ban
</Radio>
</Stack>
</RadioGroup>
);
})}
{(function () {
const radioGroups = [];
for (let i = 0; i < props.target_ids.length; i++) {
radioGroups.push(
<RadioGroup
name={props.target_ids[i].toString()}
onChange={(val) => {
Object.defineProperty(actionMap, props.target_ids[i], {
value: parseInt(val),
});
}}
>
<Stack direction="row">
<Text>{props.target_usernames[i]}</Text>
<Radio key={0} value="0">
Ignore
</Radio>
<Radio key={1} value="1">
Hide from Leaderboards
</Radio>
<Radio key={2} value="2">
Ban
</Radio>
</Stack>
</RadioGroup>
);
}
return radioGroups;
})()}
<Box pt="16px">
<Button colorScheme="blue">Submit</Button>
</Box>