Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
New formatting
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 0b5e82b commit 026d1ca
Show file tree
Hide file tree
Showing 30 changed files with 76 additions and 76 deletions.
2 changes: 1 addition & 1 deletion app/context.tsx
Expand Up @@ -15,5 +15,5 @@ export interface ClientStyleContextData {
}

export const ClientStyleContext = createContext<ClientStyleContextData | null>(
null
null,
);
2 changes: 1 addition & 1 deletion app/entry.client.tsx
Expand Up @@ -34,5 +34,5 @@ hydrateRoot(
<ClientCacheProvider>
<RemixBrowser />
</ClientCacheProvider>
</StrictMode>
</StrictMode>,
);
6 changes: 3 additions & 3 deletions app/entry.server.tsx
Expand Up @@ -10,7 +10,7 @@ export default function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
remixContext: EntryContext,
) {
const cache = createEmotionCache();
const { extractCriticalToChunks } = createEmotionServer(cache);
Expand All @@ -19,7 +19,7 @@ export default function handleRequest(
<CacheProvider value={cache}>
<RemixServer context={remixContext} url={request.url} />
</CacheProvider>
</ServerStyleContext.Provider>
</ServerStyleContext.Provider>,
);

const chunks = extractCriticalToChunks(html);
Expand All @@ -29,7 +29,7 @@ export default function handleRequest(
<CacheProvider value={cache}>
<RemixServer context={remixContext} url={request.url} />
</CacheProvider>
</ServerStyleContext.Provider>
</ServerStyleContext.Provider>,
);

responseHeaders.set("content-type", "text/html;charset=utf-8");
Expand Down
12 changes: 6 additions & 6 deletions app/root.tsx
Expand Up @@ -46,7 +46,7 @@ export function ErrorBoundary() {
<Link color="#646cff" onClick={() => location.reload()}>
Refresh
</Link>
</Container>
</Container>,
);

const { status } = error;
Expand Down Expand Up @@ -74,7 +74,7 @@ export function ErrorBoundary() {
<Link color="#646cff" onClick={() => history.go(-1)}>
Go back
</Link>
</Container>
</Container>,
);

default:
Expand All @@ -90,7 +90,7 @@ export function ErrorBoundary() {
<Link color="#646cff" onClick={() => location.reload()}>
Reload
</Link>
</Container>
</Container>,
);
}
}
Expand Down Expand Up @@ -124,7 +124,7 @@ export function meta() {

function getMarkup(
loaderData: { [k: string]: any },
child: ReactNode
child: ReactNode,
): JSX.Element {
const Document = withEmotionCache(
({ children }: { children: ReactNode }, emotionCache) => {
Expand All @@ -149,7 +149,7 @@ function getMarkup(
colorModeManager={cookieStorageManagerSSR(
typeof document === "undefined"
? `chakra-ui-color-mode=${loaderData.theme}`
: document.cookie
: document.cookie,
)}
theme={theme}
>
Expand Down Expand Up @@ -199,7 +199,7 @@ function getMarkup(
</body>
</html>
);
}
},
);

return <Document>{child}</Document>;
Expand Down
2 changes: 1 addition & 1 deletion app/routes/appeals.tsx
Expand Up @@ -44,7 +44,7 @@ export async function loader({ context }: { context: RequestContext }) {
await dataKV.list({
prefix: `appeal_${currentUser.id}`,
})
).keys.length
).keys.length,
),
can_toggle:
currentUser.permissions & (1 << 0) || currentUser.permissions & (1 << 11),
Expand Down
2 changes: 1 addition & 1 deletion components/AppealCard.tsx
Expand Up @@ -23,7 +23,7 @@ import { useEffect, useState } from "react";

export default function (props: AppealCardProps) {
const [dateString, setDateString] = useState(
new Date(props.created_at).toUTCString()
new Date(props.created_at).toUTCString(),
);
const [action, setAction] = useState("");
const [feedback, setFeedback] = useState("");
Expand Down
26 changes: 13 additions & 13 deletions components/FormGenerator.tsx
Expand Up @@ -49,7 +49,7 @@ export default function ({
state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>>,
id: string,
value: string
value: string,
) {
const newState = { ...state };
newState[id] = value;
Expand All @@ -60,7 +60,7 @@ export default function ({
function renderCheckboxOptions(
c: component,
state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>>
setState: Dispatch<SetStateAction<{}>>,
) {
if (!c.options) throw new Error("Options for checkbox are undefined");

Expand Down Expand Up @@ -88,7 +88,7 @@ export default function ({
? groupValues.push(e.target.value)
: groupValues.splice(
groupValues.findIndex((v) => v === e.target.value),
1
1,
);

newState[c.id] = groupValues;
Expand All @@ -97,7 +97,7 @@ export default function ({
value={option.value}
>
{option.value}
</Checkbox>
</Checkbox>,
);
}

Expand All @@ -111,7 +111,7 @@ export default function ({
function renderRadioElements(
c: component,
state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>>
setState: Dispatch<SetStateAction<{}>>,
) {
if (!c.options) throw new Error("Options for radio buttons are undefined!");
const buttons = [];
Expand All @@ -120,7 +120,7 @@ export default function ({
buttons.push(
<Radio checked={option.default} value={option.value}>
{option.value}
</Radio>
</Radio>,
);
}

Expand All @@ -142,7 +142,7 @@ export default function ({
function renderSelectElements(
c: component,
state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>>
setState: Dispatch<SetStateAction<{}>>,
) {
if (!c.options) throw new Error("Options for select are undefined!");

Expand Down Expand Up @@ -170,14 +170,14 @@ export default function ({
function generateReactComponents(
components: component[],
state: { [k: string]: string | string[] },
setState: Dispatch<SetStateAction<{}>>
setState: Dispatch<SetStateAction<{}>>,
): JSX.Element[] {
const fragmentsList = [];

for (const component of components) {
fragmentsList.push(
<Heading size="md">{component.title}</Heading>,
<br />
<br />,
);

switch (component.type) {
Expand All @@ -204,15 +204,15 @@ export default function ({
value={component.value}
/>
<FormErrorMessage>Field is required</FormErrorMessage>
</FormControl>
</FormControl>,
);
break;

case "number":
fragmentsList.push(
<NumberInput
isInvalid={isNumberElemInvalid(
document.getElementById(component.id) as HTMLInputElement
document.getElementById(component.id) as HTMLInputElement,
)}
isReadOnly={read_only}
>
Expand All @@ -227,7 +227,7 @@ export default function ({
<NumberIncrementStepper />
<NumberDecrementStepper />
</NumberInputStepper>
</NumberInput>
</NumberInput>,
);
break;

Expand Down Expand Up @@ -256,7 +256,7 @@ export default function ({
style={{ display: page ? "none" : undefined }}
>
{generateReactComponents(componentList, responses, setResponses)}
</div>
</div>,
);
}

Expand Down
4 changes: 2 additions & 2 deletions components/GameAppealCard.tsx
Expand Up @@ -22,7 +22,7 @@ import {
export default function (props: GameAppealProps) {
async function performAction(action: "accept" | "deny"): Promise<void> {
const statsReduction = parseInt(
(document.getElementById("reductPercentage") as HTMLInputElement).value
(document.getElementById("reductPercentage") as HTMLInputElement).value,
);

const actionResponse = await fetch(`/api/game-appeals/${props.roblox_id}`, {
Expand All @@ -49,7 +49,7 @@ export default function (props: GameAppealProps) {
duration: 10000,
status: "error",
title: "An error occurred...",
}
},
);
}

Expand Down
3 changes: 3 additions & 0 deletions components/Navigation.tsx
Expand Up @@ -112,6 +112,9 @@ export default function (props: {
<Link href="/support" size="lg">
Support
</Link>
<Link href="https://ccdiscussion.com" size="lg">
Community
</Link>
<Link
display={hasMod() ? undefined : "none"}
href="/mod-queue"
Expand Down
2 changes: 1 addition & 1 deletion components/NewInfractionModal.tsx
Expand Up @@ -18,7 +18,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
if (!props.isOpen) return;

const evidenceElement = document.getElementById(
"evidence"
"evidence",
) as HTMLInputElement;

if (!evidenceElement.files && e.clipboardData?.files) {
Expand Down
4 changes: 2 additions & 2 deletions emotion-server.js
Expand Up @@ -55,7 +55,7 @@ function createConstructStyleTagsFromChunks(cache, nonceString) {
item.key,
item.ids.join(" "),
item.css,
nonceString
nonceString,
);
});

Expand All @@ -73,7 +73,7 @@ export function createEmotionServer(cache) {
extractCriticalToChunks: createExtractCriticalToChunks(cache),
constructStyleTagsFromChunks: createConstructStyleTagsFromChunks(
cache,
nonceString
nonceString,
),
};
}
5 changes: 1 addition & 4 deletions functions/_middleware.ts
Expand Up @@ -106,10 +106,7 @@ async function setHeaders(context: RequestContext) {
"Content-Security-Policy",
"connect-src: https://o1071757.ingest.sentry.io https://storage.googleapis.com self; default-src: self; frame-src: https://challenges.cloudflare.com; img-src: https://cdn.discordapp.com https://mediaproxy.carcrushers.cc self; media-src: https://mediaproxy.carcrushers.cc; report-uri: https://o1071757.ingest.sentry.io/api/6069431/security/?sentry_key=3d2b34700e6942f9b739cd8b2001f70f; script=src: https://challenges.cloudflare.com self",
);
response.headers.set(
"Permissions-Policy",
"clipboard-write=(self)",
);
response.headers.set("Permissions-Policy", "clipboard-write=(self)");
response.headers.set("Referrer-Policy", "same-origin");
response.headers.set(
"RTV",
Expand Down
2 changes: 1 addition & 1 deletion functions/api/admin-apps/submit.ts
Expand Up @@ -7,7 +7,7 @@ export async function onRequest(context: RequestContext) {
});

const deliveryDate = new Date(
Date.now() + 86400000 + Math.round(Math.random() * 172800000)
Date.now() + 86400000 + Math.round(Math.random() * 172800000),
)
.toUTCString()
.replace("GMT", "+0000");
Expand Down
4 changes: 2 additions & 2 deletions functions/api/appeals/[id]/accept.ts
Expand Up @@ -15,7 +15,7 @@ export async function onRequestPost(context: RequestContext) {
authorization: `Basic ${btoa("api:" + context.env.MAILGUN_API_KEY)}`,
},
method: "POST",
}
},
);

if (!emailReq.ok) {
Expand All @@ -38,7 +38,7 @@ export async function onRequestPost(context: RequestContext) {
"x-audit-log-reason": `Appeal accepted by ${currentUser.username}#${currentUser.discriminator} (${currentUser.id})`,
},
method: "DELETE",
}
},
);

await fetch(context.env.APPEALS_WEBHOOK, {
Expand Down
2 changes: 1 addition & 1 deletion functions/api/appeals/[id]/ban.ts
Expand Up @@ -11,7 +11,7 @@ export async function onRequestPost(context: RequestContext) {

await context.env.DATA.put(
`appealban_${context.data.targetId}`,
JSON.stringify({ moderator: currentUser.id })
JSON.stringify({ moderator: currentUser.id }),
);
await fetch(context.env.APPEALS_WEBHOOK, {
body: JSON.stringify({
Expand Down
2 changes: 1 addition & 1 deletion functions/api/appeals/[id]/deny.ts
Expand Up @@ -15,7 +15,7 @@ export async function onRequestPost(context: RequestContext) {
authorization: `Basic ${btoa("api:" + context.env.MAILGUN_API_KEY)}`,
},
method: "POST",
}
},
);

if (!emailReq.ok) {
Expand Down
8 changes: 4 additions & 4 deletions functions/api/appeals/submit.ts
Expand Up @@ -19,7 +19,7 @@ export async function onRequestPost(context: RequestContext) {
"content-type": "application/json",
},
status: 400,
}
},
);

const { current_user: currentUser } = context.data;
Expand All @@ -36,13 +36,13 @@ export async function onRequestPost(context: RequestContext) {
prefix: `appeal_${currentUser.id}`,
});
const existingBlockedAppeal = await context.env.DATA.get(
`blockedappeal_${currentUser.id}`
`blockedappeal_${currentUser.id}`,
);

if (
existingBlockedAppeal ||
existingAppeals.keys.find(
(appeal) => (appeal.metadata as { [k: string]: any })?.open
(appeal) => (appeal.metadata as { [k: string]: any })?.open,
)
)
return new Response('{"error":"Appeal already submitted"}', {
Expand Down Expand Up @@ -82,7 +82,7 @@ export async function onRequestPost(context: RequestContext) {
}),
{
expirationTtl: 94608000,
}
},
);

await fetch(context.env.APPEALS_WEBHOOK, {
Expand Down
4 changes: 2 additions & 2 deletions functions/api/auth/oauth.ts
Expand Up @@ -14,7 +14,7 @@ export async function onRequestGet(context: RequestContext) {
`https://discord.com/oauth2/authorize?client_id=${
env.DISCORD_ID
}&redirect_uri=${encodeURIComponent(
`${protocol}//${host}/api/auth/session`
)}&response_type=code&scope=identify%20email%20guilds.members.read&state=${state}`
`${protocol}//${host}/api/auth/session`,
)}&response_type=code&scope=identify%20email%20guilds.members.read&state=${state}`,
);
}

0 comments on commit 026d1ca

Please sign in to comment.