Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Set display: none instead of visibility: hidden to reduce wasted space
regalijan committed Oct 22, 2023
1 parent 7df177d commit 53f5b0a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions components/ReportCard.tsx
@@ -13,11 +13,11 @@ import {
Stack,
Text,
useToast,
VStack,
VStack
} from "@chakra-ui/react";
import { useState } from "react";

export default function (props: ReportCardProps) {
export default function(props: ReportCardProps) {
const [attachmentIdx, setAttachmentIdx] = useState(0);
const [loading, setLoading] = useState(false);
const toast = useToast();
@@ -26,25 +26,25 @@ export default function (props: ReportCardProps) {

for (let i = 0; i < props.target_ids.length; i++)
Object.defineProperty(targetMap, props.target_ids[i], {
value: props.target_usernames[i],
value: props.target_usernames[i]
});

async function submitActions() {
setLoading(true);
const submitReq = await fetch(`/api/reports/${props.id}/action`, {
body: JSON.stringify(actionMap),
headers: {
"content-type": "application/json",
"content-type": "application/json"
},
method: "POST",
method: "POST"
});

if (!submitReq.ok) {
setLoading(false);
toast({
description: ((await submitReq.json()) as { error: string }).error,
status: "error",
title: "S̸̯̜̈́o̴̳̅̾̏̽m̴͔͕̈́̋ē̴̙͓̯̍̃ț̸͖̘̀h̶̛̳̝̐i̵̋͘͜ņ̷̙̤͌g̴̭̻̓̈́ ̴̘͍̦̪̆w̸̡̏̑̊é̸̠̖̹̂͜n̴̖̳̤̕t̴͚̊̊̕ ̸̛͙̺̬̎́w̴͈͑̋͊r̷̢̛o̵̱̩̍͋ͅṇ̸̝̰̮́g̵̡̢̦͕͂",
title: "S̸̯̜̈́o̴̳̅̾̏̽m̴͔͕̈́̋ē̴̙͓̯̍̃ț̸͖̘̀h̶̛̳̝̐i̵̋͘͜ņ̷̙̤͌g̴̭̻̓̈́ ̴̘͍̦̪̆w̸̡̏̑̊é̸̠̖̹̂͜n̴̖̳̤̕t̴͚̊̊̕ ̸̛͙̺̬̎́w̴͈͑̋͊r̷̢̛o̵̱̩̍͋ͅṇ̸̝̰̮́g̵̡̢̦͕͂"
});

return;
@@ -53,7 +53,7 @@ export default function (props: ReportCardProps) {
toast({
description: "Actions were successfully applied",
status: "success",
title: "Success",
title: "Success"
});
setLoading(false);
location.reload();
@@ -130,9 +130,9 @@ export default function (props: ReportCardProps) {
<br />
<Text my="16px">{props.description}</Text>
</CardBody>
<CardFooter visibility={props.open ? "visible" : "hidden"}>
<CardFooter display={props.open ? undefined : "none"}>
<Stack direction="column" gap="16px">
{(function () {
{(function() {
const radioGroups = [];
for (let i = 0; i < props.target_ids.length; i++) {
radioGroups.push(
@@ -154,7 +154,7 @@ export default function (props: ReportCardProps) {
Ban
</Radio>
</VStack>
</RadioGroup>,
</RadioGroup>
);
}

0 comments on commit 53f5b0a

Please sign in to comment.