Skip to content

Commit

Permalink
feat: 정답 모달 > 다음 문제 풀러가기 기능
Browse files Browse the repository at this point in the history
[#2]
  • Loading branch information
YuHyun-P authored and flydog98 committed Dec 14, 2023
1 parent 0150110 commit a5152c5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/frontend/src/pages/quizzes/[id].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import EditorInfo from "../../components/editor/EditorInfo";
import { SolvedModal } from "../../components/quiz";
import { QuizGuide } from "../../components/quiz/QuizGuide";
import { Terminal } from "../../components/terminal";
import { BROWSWER_PATH } from "../../constants/path";
import { Button, toast } from "../../design-system/components/common";
import useResizableSplitView from "../../hooks/useResizableSplitView";
import { useSolvedModal } from "../../hooks/useSolvedModal";
Expand All @@ -25,9 +26,10 @@ import { isString } from "../../utils/typeGuard";
import * as styles from "./quiz.css";

export default function QuizPage({ quiz }: { quiz: Quiz }) {
const router = useRouter();
const {
query: { id },
} = useRouter();
} = router;

const solvedModal = useSolvedModal(isString(id) ? +id : -1);
const [{ terminalMode, editorFile, contentArray }, terminalDispatch] =
Expand Down Expand Up @@ -73,6 +75,15 @@ export default function QuizPage({ quiz }: { quiz: Quiz }) {
}
};

const handleNextQuizPage = () => {
if (!isString(id)) {
return;
}

solvedModal.closeModal();
router.push(`${BROWSWER_PATH.QUIZZES}/${+id + 1}`);
};

const handleResponseError = (error: unknown) => {
if (
isAxiosError(error) &&
Expand Down Expand Up @@ -157,7 +168,7 @@ export default function QuizPage({ quiz }: { quiz: Quiz }) {
link={solvedModal.shareLink}
lastQuiz={solvedModal.lastQuiz}
onClose={solvedModal.closeModal}
onNextQuiz={console.log}
onNextQuiz={handleNextQuizPage}
/>
)}
</>
Expand Down

0 comments on commit a5152c5

Please sign in to comment.