Skip to content

Commit

Permalink
Fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rorre committed Oct 7, 2023
1 parent 5da7c23 commit 9883be1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
21 changes: 12 additions & 9 deletions src/components/module/dashboard/docs/DocsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getUser } from "@/components/fetcher/user";
import { useQuery } from "@tanstack/react-query";
import React, { useEffect, useState } from "react";
import React, { useEffect, useMemo, useState } from "react";
import katex from "katex";
import "katex/dist/katex.min.css";

Expand All @@ -9,7 +9,7 @@ interface DocsInterface {
content: string;
}

function getDocs() {
function useDocs() {
const { data: apiDoc } = useQuery({
queryKey: ["apiDoc"],
queryFn: () => getUser<string>("docs/api"),
Expand All @@ -26,13 +26,16 @@ function getDocs() {
}

export default function DocsPage() {
const { apiDoc, patchDoc, scoreDoc } = getDocs();
const { apiDoc, patchDoc, scoreDoc } = useDocs();

const docsMenu: { [index: string]: DocsInterface } = {
api: { label: "API", content: apiDoc?.data ?? "" },
patching: { label: "Patching", content: patchDoc?.data ?? "" },
scoring: { label: "Scoring", content: scoreDoc?.data ?? "" },
};
const docsMenu: { [index: string]: DocsInterface } = useMemo(
() => ({
api: { label: "API", content: apiDoc?.data ?? "" },
patching: { label: "Patching", content: patchDoc?.data ?? "" },
scoring: { label: "Scoring", content: scoreDoc?.data ?? "" },
}),
[apiDoc, patchDoc, scoreDoc]
);

const [menuActive, setMenuActive] = useState("api");
const [docsContent, setDocsContent] = useState(docsMenu["api"].content);
Expand Down Expand Up @@ -77,7 +80,7 @@ export default function DocsPage() {
<div className="p-4 rounded-md m-4">
<article
className="prose dark:prose-invert max-w-none"
style={{color: "white"}}
style={{ color: "white" }}
dangerouslySetInnerHTML={{ __html: docsContent ?? "" }}
></article>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/attackmap.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useContestContext } from "@/components/module/ContestContext";
import AttackMapPage from "@/components/module/attackmap/AttackMapPage";

export default function attackmap() {
export default function AttackMap() {
const { contest } = useContestContext();
return (
<div className="flex flex-col min-h-screen p-4 container mx-auto gap-4">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useContestContext } from "@/components/module/ContestContext";
import Leaderboard from "@/components/module/leaderboard/Leaderboard";
import React from "react";

export default function leaderboard() {
export default function LeaderboardPage() {
const { contest } = useContestContext();

return (
Expand Down

0 comments on commit 9883be1

Please sign in to comment.