import { Box, Typography, Button } from "@mui/material"; import { getQuestionByContentId } from "@root/questions/actions"; import { useCurrentQuiz } from "@root/quizes/hooks"; import { useQuestionsStore } from "@root/questions/store"; import type { AnyTypedQuizQuestion } from "../../model/questionTypes/shared"; import YoutubeEmbedIframe from "../../ui_kit/StartPagePreview/YoutubeEmbedIframe.tsx" type ResultFormProps = { currentQuestion: AnyTypedQuizQuestion; showContactForm: boolean; setShowContactForm: (show: boolean) => void; setShowResultForm: (show: boolean) => void; }; export const ResultForm = ({ currentQuestion, showContactForm, setShowContactForm, setShowResultForm, }: ResultFormProps) => { const quiz = useCurrentQuiz(); const { questions } = useQuestionsStore(); const resultQuestion = questions.find( (question) => question.type === "result" && question.content.rule.parentId === currentQuestion.content.id ); const followNextForm = () => { setShowResultForm(false); setShowContactForm(true); }; return ( { !resultQuestion?.content.useImage && resultQuestion.content.video && } { resultQuestion?.content.useImage && resultQuestion.content.back && } {resultQuestion.description !== "" && resultQuestion.description !== " " && {resultQuestion.description}} {resultQuestion.title || "Форма результатов"} {!showContactForm && quiz?.config.resultInfo.when !== "after" && ( )} ); };