import { Box, Typography, Button, useMediaQuery, useTheme, } from "@mui/material"; import { useQuestionsStore } from "@stores/quizData/store"; import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe"; import { NameplateLogo } from "@icons/NameplateLogo"; import { modes } from "../../utils/themes/Publication/themePublication"; import type { QuizQuestionResult } from "../../model/questionTypes/result"; 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 = (): QuizQuestionResult => { 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" )) as QuizQuestionResult; } else { return items.find( (question) => question.type === "result" && question.content.rule.parentId === "line" ) as QuizQuestionResult; } }; 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.showResultForm === "before" && ( )} {settings?.cfg.resultInfo.showResultForm === "after" && resultQuestion.content.redirect && ( )} ); } };