Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Le formatting fixes
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 0a4ad77 commit 3155442
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 125 deletions.
12 changes: 6 additions & 6 deletions app/routes/appeals.tsx
Expand Up @@ -64,11 +64,11 @@ export default function () {
const pageProps = useLoaderData<typeof loader>();
const { isOpen, onClose, onOpen } = useDisclosure();
const [showSuccess, setShowSuccess] = useState(false);
const [loading, setLoading] = useState(false)
const [loading, setLoading] = useState(false);
const toast = useToast();

async function submit() {
setLoading(true)
setLoading(true);
const learned = (document.getElementById("learned") as HTMLInputElement)
.value;
const whyBanned = (document.getElementById("whyBanned") as HTMLInputElement)
Expand All @@ -89,7 +89,7 @@ export default function () {
}).catch(() => {});

if (!submitReq) {
setLoading(false)
setLoading(false);
return toast({
description: "Please check your internet and try again",
duration: 10000,
Expand All @@ -100,7 +100,7 @@ export default function () {
}

if (!submitReq.ok) {
setLoading(false)
setLoading(false);
return toast({
description: ((await submitReq.json()) as { error: string }).error,
duration: 10000,
Expand All @@ -111,7 +111,7 @@ export default function () {
}

setShowSuccess(true);
setLoading(false)
setLoading(false);
}

async function toggle(active: boolean) {
Expand Down Expand Up @@ -239,7 +239,7 @@ export default function () {
<Button
disabled={pageProps.can_appeal}
onClick={async () => await submit()}
loadingText='Submitting'
loadingText="Submitting"
isLoading={loading}
>
Submit
Expand Down
8 changes: 4 additions & 4 deletions app/routes/data-transfer/start.tsx
Expand Up @@ -13,7 +13,7 @@ import { useState } from "react";

export default function () {
const [showCookieBox, setShowCookieBox] = useState(false);
const [loading, setLoading] = useState(false)
const [loading, setLoading] = useState(false);
return (
<Container maxW="container.md">
<Heading pt="36px">Let's get started</Heading>
Expand All @@ -32,7 +32,7 @@ export default function () {
/>
<Button
onClick={async () => {
setLoading(true)
setLoading(true);
const createTransferReq = await fetch("/api/data-transfers/create", {
body: JSON.stringify({
can_access: !showCookieBox,
Expand All @@ -47,7 +47,7 @@ export default function () {
});

if (!createTransferReq.ok) {
setLoading(false)
setLoading(false);
useToast()({
description: (
(await createTransferReq.json()) as { error: string }
Expand All @@ -66,7 +66,7 @@ export default function () {
}}
pt="32px"
isLoading={loading}
loadingText='Processing...'
loadingText="Processing..."
>
Continue
</Button>
Expand Down
20 changes: 10 additions & 10 deletions app/routes/report.tsx
Expand Up @@ -42,7 +42,7 @@ export default function () {
const [supportsRequestStreams, setSupportsRequestStreams] = useState(false);
const toast = useToast();
const [uploading, setUploading] = useState(false);
const [loading, setLoading] = useState(false)
const [loading, setLoading] = useState(false);
const fileTypes: { [k: string]: string } = {
gif: "image/gif",
m4v: "video/x-m4v",
Expand Down Expand Up @@ -76,7 +76,7 @@ export default function () {
const { logged_in, site_key } = useLoaderData<typeof loader>();

async function submit() {
setLoading(true)
setLoading(true);
const usernames = (
document.getElementById("usernames") as HTMLInputElement
).value
Expand All @@ -86,7 +86,7 @@ export default function () {
.files;

if (!usernames.length) {
setLoading(false)
setLoading(false);
return toast({
description: "Must provide at least one username",
isClosable: true,
Expand All @@ -96,7 +96,7 @@ export default function () {
}

if (!files?.length) {
setLoading(false)
setLoading(false);
return toast({
description: "Must attach at least one file",
isClosable: true,
Expand All @@ -106,7 +106,7 @@ export default function () {
}

if (usernames.length > 20) {
setLoading(false)
setLoading(false);
return toast({
description: "Only up to twenty users can be reported at a time",
isClosable: true,
Expand All @@ -123,7 +123,7 @@ export default function () {
.item(0) as HTMLInputElement;

if (!tokenElem.value) {
setLoading(false)
setLoading(false);
return toast({
description: "Please complete the captcha and try again",
isClosable: true,
Expand Down Expand Up @@ -160,7 +160,7 @@ export default function () {
});

if (!submitReq.ok) {
setLoading(false)
setLoading(false);
if (!logged_in) {
try {
// @ts-expect-error
Expand Down Expand Up @@ -235,7 +235,7 @@ export default function () {
}

if (shouldRecall) {
setLoading(false)
setLoading(false);
await fetch("/api/reports/recall", {
body: JSON.stringify({ id }),
headers: {
Expand Down Expand Up @@ -264,7 +264,7 @@ export default function () {
});

setShowSuccess(true);
setLoading(false)
setLoading(false);
}

useEffect(() => {
Expand Down Expand Up @@ -332,7 +332,7 @@ export default function () {
disabled={uploading}
mr="8px"
onClick={async () => await submit()}
loadingText='Submitting'
loadingText="Submitting"
isLoading={loading}
>
Submit
Expand Down
12 changes: 6 additions & 6 deletions components/AppealCard.tsx
Expand Up @@ -27,7 +27,7 @@ export default function (props: AppealCardProps) {
);
const [action, setAction] = useState("");
const [feedback, setFeedback] = useState("");
const [loading, setLoading] = useState(false)
const [loading, setLoading] = useState(false);
const toast = useToast();

useEffect(() => {
Expand All @@ -42,7 +42,7 @@ export default function (props: AppealCardProps) {
}

async function takeAction(action: string) {
setLoading(true)
setLoading(true);
const actionReq = await fetch(`/api/appeals/${props.id}/${action}`, {
body: feedback ? JSON.stringify({ feedback }) : "{}",
headers: {
Expand All @@ -52,7 +52,7 @@ export default function (props: AppealCardProps) {
});

if (actionReq.ok) {
setLoading(false)
setLoading(false);
toast({
description: `Appeal ${action === "accept" ? "accepted" : "denied"}`,
duration: 5000,
Expand All @@ -62,7 +62,7 @@ export default function (props: AppealCardProps) {

document.getElementById(`appeal_${props.id}`)?.remove();
} else {
setLoading(false)
setLoading(false);
toast({
description: ((await actionReq.json()) as { error: string }).error,
duration: 10000,
Expand All @@ -72,7 +72,7 @@ export default function (props: AppealCardProps) {
}

onClose();
setLoading(false)
setLoading(false);
}

return (
Expand All @@ -92,7 +92,7 @@ export default function (props: AppealCardProps) {
<Button
onClick={async () => await takeAction(action.toLowerCase())}
isLoading={loading}
loadingText='Submitting...'
loadingText="Submitting..."
>
Submit
</Button>
Expand Down
8 changes: 4 additions & 4 deletions components/GameAppealCard.tsx
Expand Up @@ -21,9 +21,9 @@ import {
import { useState } from "react";

export default function (props: GameAppealProps) {
const [loading, setLoading] = useState(false)
const [loading, setLoading] = useState(false);
async function performAction(action: "accept" | "deny"): Promise<void> {
setLoading(true)
setLoading(true);
const statsReduction = parseInt(
(document.getElementById("reductPercentage") as HTMLInputElement).value,
);
Expand Down Expand Up @@ -55,7 +55,7 @@ export default function (props: GameAppealProps) {
},
);

setLoading(false)
setLoading(false);
}

const { isOpen, onClose, onOpen } = useDisclosure();
Expand Down Expand Up @@ -114,7 +114,7 @@ export default function (props: GameAppealProps) {
ml="8px"
onClick={async () => await performAction("accept")}
isLoading={loading}
loadingText='Submitting...'
loadingText="Submitting..."
>
Submit
</Button>
Expand Down
30 changes: 14 additions & 16 deletions components/InactivityNoticeCard.tsx
Expand Up @@ -11,31 +11,31 @@ import {
StackDivider,
Text,
UnorderedList,
useToast
useToast,
} from "@chakra-ui/react";
import { useState } from "react";

export default function(props: InactivityNoticeProps) {
export default function (props: InactivityNoticeProps) {
const toast = useToast();
const [loading, setLoading] = useState(false)
const [loading, setLoading] = useState(false);

async function makeDecision(accepted: boolean) {
setLoading(true)
setLoading(true);
const decisionReq = await fetch(`/api/inactivity/${props.id}`, {
body: JSON.stringify({ accepted }),
headers: {
"content-type": "application/json"
"content-type": "application/json",
},
method: "POST"
method: "POST",
});

if (!decisionReq.ok) {
setLoading(false)
setLoading(false);
toast({
description: ((await decisionReq.json()) as { error: string }).error,
isClosable: true,
status: "error",
title: "Oops"
title: "Oops",
});

return;
Expand All @@ -45,24 +45,22 @@ export default function(props: InactivityNoticeProps) {
description: `Inactivity notice ${accepted ? "accepted" : "denied"}.`,
isClosable: true,
status: "success",
title: "Success"
title: "Success",
});

setLoading(false)
setLoading(false);
location.reload();
}

const Approved = () => (
<svg fill="currentColor" height="16" viewBox="0 0 16 16" width="16">
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" />
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" />
</svg>
);

const Denied = () => (
<svg fill="currentColor" height="16" viewBox="0 0 16 16" width="16">
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z" />
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z" />
</svg>
);

Expand Down Expand Up @@ -109,7 +107,7 @@ export default function(props: InactivityNoticeProps) {
colorScheme="red"
onClick={async () => await makeDecision(false)}
isLoading={loading}
loadingText='Processing...'
loadingText="Processing..."
>
Deny
</Button>
Expand All @@ -118,7 +116,7 @@ export default function(props: InactivityNoticeProps) {
ml="8px"
onClick={async () => await makeDecision(true)}
isLoading={loading}
loadingText='Processing...'
loadingText="Processing..."
>
Accept
</Button>
Expand Down

0 comments on commit 3155442

Please sign in to comment.