import React from "react"; import Link from "next/link"; import { useEditorContext } from "../../context/hooks"; import QuestionCircleSVG from "../../../public/svg/question-circle.svg"; import EyeSVG from "../../../public/svg/eye.svg"; import EyeOffSVG from "../../../public/svg/eye-off.svg"; import ArrowLeftSVG from "../../../public/svg/arrow-left.svg"; import ArrowRightSVG from "../../../public/svg/arrow-right.svg"; import DocumentSVG from "../../../public/svg/document.svg"; import CodeFileSVG from "../../../public/svg/code-file.svg"; import CheckSVG from "../../../public/svg/check.svg"; import { checkAnswer } from "../../../src/utils/answerCheck"; import type { ChapterProps } from "../../types/ChapterPage"; import { getFooterValues } from "./Footer.utils"; export default function Footer({ title, answerFile, currentLessonId, currentChapterId, prevChapter, nextChapter, currentChapterIndex, chaptersLength, }: ChapterProps) { const isLastChapter = currentChapterIndex === chaptersLength - 1; const { fileContent, showAnswer, showDocument, isFailed, setShowAnswer, setShowDocument, setIsFailed, } = useEditorContext(); const handleCheckAnswer = () => { const isCorrect = checkAnswer(fileContent || "", answerFile?.body || ""); setIsFailed(!isCorrect); }; const handleToggleShowDocument = () => { setShowDocument(!showDocument); }; const { previouseChapterHref, nextChapterHref, chapterIndicatorText } = getFooterValues({ isLastChapter, currentLessonId, currentChapterId, prevChapter, nextChapter, currentChapterIndex, chaptersLength, }); return ( ); }