diff --git a/packages/frontend/src/pages/_app.tsx b/packages/frontend/src/pages/_app.page.tsx similarity index 100% rename from packages/frontend/src/pages/_app.tsx rename to packages/frontend/src/pages/_app.page.tsx diff --git a/packages/frontend/src/pages/_document.tsx b/packages/frontend/src/pages/_document.page.tsx similarity index 100% rename from packages/frontend/src/pages/_document.tsx rename to packages/frontend/src/pages/_document.page.tsx diff --git a/packages/frontend/src/pages/index.tsx b/packages/frontend/src/pages/index.page.tsx similarity index 100% rename from packages/frontend/src/pages/index.tsx rename to packages/frontend/src/pages/index.page.tsx diff --git a/packages/frontend/src/pages/quizzes/[id].tsx b/packages/frontend/src/pages/quizzes/[id].tsx deleted file mode 100644 index d23fb384..00000000 --- a/packages/frontend/src/pages/quizzes/[id].tsx +++ /dev/null @@ -1,95 +0,0 @@ -import axios from "axios"; -import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from "next"; -import { useRouter } from "next/router"; -import { useEffect, useState } from "react"; - -import { quizAPI } from "../../apis/quiz"; -import * as styles from "../../components/demo/Demo.css"; -import { CommandAccordion, QuizContent } from "../../components/quiz"; -import { Terminal } from "../../components/terminal"; -import { Button } from "../../design-system/components/common"; -import { flex } from "../../design-system/tokens/utils.css"; -import { Categories, Quiz } from "../../types/quiz"; -import { TerminalContentType } from "../../types/terminalType"; -import { isString } from "../../utils/typeGuard"; - -export default function QuizPage({ quiz }: { quiz: Quiz }) { - const [contentArray, setContentArray] = useState([]); - const { - query: { id }, - } = useRouter(); - - useEffect(() => { - setContentArray([]); - }, [id]); - - const handleTerminal = async (input: string) => { - if (!isString(id)) { - return; - } - - const data = await quizAPI.postCommand({ - id: +id, - command: input, - }); - setContentArray([ - ...contentArray, - { type: "stdin", content: input }, - { type: "stdout", content: data.message }, - ]); - }; - - if (!quiz) return null; - return ( -
-
-
-
-
- -
- -
-
- -
-
-
- -
-
- -
-
- ); -} - -export const getStaticProps = (async ({ params }: GetStaticPropsContext) => { - const { data } = await axios.get( - `https://git-challenge.com/api/v1/quizzes/${params?.id}`, - ); - - return { - props: { - quiz: data, - }, - }; -}) satisfies GetStaticProps<{ - quiz: Quiz; -}>; - -export const getStaticPaths = (async () => { - const { - data: { categories }, - } = await axios.get("https://git-challenge.com/api/v1/quizzes"); - - const paths = categories.flatMap(({ quizzes }) => - quizzes.map(({ id }) => ({ params: { id: String(id) } })), - ); - - return { paths, fallback: "blocking" }; -}) satisfies GetStaticPaths;