import { Box, Typography, Button, useMediaQuery, useTheme } from "@mui/material"; import { useQuestionsStore } from "@root/quizData/store" import type { QuizQuestionResult } from "@model/questionTypes/result"; import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe" import { NameplateLogo } from "@icons/NameplateLogo"; import { modes } from "../../utils/themes/Publication/themePublication"; type ResultFormProps = { currentQuestion: any; showContactForm: boolean; setShowContactForm: (show: boolean) => void; setShowResultForm: (show: boolean) => void; }; export const ResultForm = ({ currentQuestion, showContactForm, setShowContactForm, setShowResultForm, }: ResultFormProps) => { const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down(650)); const { settings, items } = useQuestionsStore() const mode = modes; const searchResult = () => { if (Boolean(settings?.cfg.haveRoot)) { //ищём для ветвления return (items.find( (question) => question.type === "result" && question.content.rule.parentId === currentQuestion.content.id, ) || items.find( (question) => question.type === "result" && question.content.rule.parentId === "line", )) } else { return items.find( (question) => question.type === "result" && question.content.rule.parentId === "line", ) } }; const resultQuestion = searchResult(); const followNextForm = () => { setShowResultForm(false); setShowContactForm(true); }; console.log(resultQuestion) if (resultQuestion === null || resultQuestion === undefined) { followNextForm() return <> } else { return ( { //@ts-ignore !resultQuestion?.content.useImage && resultQuestion.content.video && ( )} { //@ts-ignore resultQuestion?.content.useImage && resultQuestion.content.back && ( )} {resultQuestion.description !== "" && resultQuestion.description !== " " && ( {resultQuestion.description} )} {resultQuestion.title} { //@ts-ignore resultQuestion.content.text !== "" && //@ts-ignore resultQuestion.content.text !== " " && ( { //@ts-ignore resultQuestion.content.text} )} Сделано на PenaQuiz {settings?.cfg.resultInfo.when === "before" && ( <> )} ); } };