diff --git a/src/pages/ContactFormPage/ContactFormPage.tsx b/src/pages/ContactFormPage/ContactFormPage.tsx index f7ff4176..44e9f9e9 100644 --- a/src/pages/ContactFormPage/ContactFormPage.tsx +++ b/src/pages/ContactFormPage/ContactFormPage.tsx @@ -350,7 +350,7 @@ const EmptyCard = ({ drawerNewFieldHC }: { drawerNewFieldHC: (a: string) => void disableRestoreFocus > - Если вам не нужно собирать контакты,

отключите форму контактов + Будут поля:

Имя, Email, Телефон
diff --git a/src/pages/ResultPage/cards/WhenCard.tsx b/src/pages/ResultPage/cards/WhenCard.tsx index fdd8fe94..ef29c844 100644 --- a/src/pages/ResultPage/cards/WhenCard.tsx +++ b/src/pages/ResultPage/cards/WhenCard.tsx @@ -159,7 +159,7 @@ export const WhenCard = ({ quizExpand }: Props) => { - { + {/* { (quiz?.config.resultInfo.when !== "email") && { onClick={(event) => updateQuiz(quiz.id, (quiz) => quiz.config.resultInfo.replay = event.target.checked)} value={quiz?.config.resultInfo.replay} /> - } + } */} diff --git a/src/pages/ViewPublicationPage/ApologyPage.tsx b/src/pages/ViewPublicationPage/ApologyPage.tsx new file mode 100644 index 00000000..658abd54 --- /dev/null +++ b/src/pages/ViewPublicationPage/ApologyPage.tsx @@ -0,0 +1,21 @@ +import { Box, Typography } from "@mui/material"; + +export const ApologyPage = (message: string) => { + return ( + + {message || "что-то пошло не так"} + + + + ) +} \ No newline at end of file diff --git a/src/pages/ViewPublicationPage/ContactForm.tsx b/src/pages/ViewPublicationPage/ContactForm.tsx index 1509b5b7..760026aa 100644 --- a/src/pages/ViewPublicationPage/ContactForm.tsx +++ b/src/pages/ViewPublicationPage/ContactForm.tsx @@ -1,4 +1,4 @@ -import { Box, Typography, Button, Paper, TextField, Link, FormControl } from "@mui/material"; +import { Box, Typography, Button, Paper, TextField, Link, InputAdornment } from "@mui/material"; import NameIcon from "@icons/ContactFormIcon/NameIcon"; import EmailIcon from "@icons/ContactFormIcon/EmailIcon"; import PhoneIcon from "@icons/ContactFormIcon/PhoneIcon"; @@ -70,8 +70,21 @@ export const ContactForm = ({ fontSize: "28px" }} > - Заполните форму, чтобы получить результаты теста + {quiz?.config.formContact.title || "Заполните форму, чтобы получить результаты теста"} + + { + quiz?.config.formContact.desc && + + {quiz?.config.formContact.desc} + + } @@ -91,14 +104,7 @@ export const ContactForm = ({ my: "20px" }} > - { - icons.map((data) => { - const FC = quiz?.config.formContact[data.type] - return FC.used ? - : - <> - }) - } + @@ -108,7 +114,9 @@ export const ContactForm = ({ ( )} @@ -136,6 +144,30 @@ export const ContactForm = ({ ); }; +const Inputs = () => { + const quiz = useCurrentQuiz(); + + let someUsed = [] + + const Icons = icons.map((data) => { + const FC = quiz?.config.formContact[data.type] + if (FC.used) someUsed.push() + return + }) + + console.log(someUsed) + console.log(Icons) + if (someUsed.length) { + return <>{someUsed} + } else { + return <> + {Icons[0]} + {Icons[1]} + {Icons[2]} + + } +} + const CustomInput = ({ title, desc, Icon }: any) => { return {title} @@ -145,7 +177,7 @@ const CustomInput = ({ title, desc, Icon }: any) => { }} placeholder={desc} InputProps={{ - startAdornment: , + startAdornment: , }} /> diff --git a/src/pages/ViewPublicationPage/Footer.tsx b/src/pages/ViewPublicationPage/Footer.tsx index a6708f37..f036634a 100644 --- a/src/pages/ViewPublicationPage/Footer.tsx +++ b/src/pages/ViewPublicationPage/Footer.tsx @@ -95,13 +95,11 @@ export const Footer = ({ } }, [question, answers]); - const showResult = () => { - const resultQuestion = questions.find( - ({ type, content }) => - type === "result" && content.rule.parentId === question.content.id - ); + const showResult = nextQuestion => { - if (quiz?.config.resultInfo.when !== "after" && resultQuestion) { + console.log(nextQuestion) + + if (nextQuestion && quiz?.config.resultInfo.when === "before") { setShowResultForm(true); } else { setShowContactForm(true); @@ -183,10 +181,13 @@ export const Footer = ({ const questionIndex = questions.findIndex(({ id }) => id === question.id); const nextQuestion = questions[questionIndex + 1]; + console.log(nextQuestion) if (nextQuestion && nextQuestion.type !== "result") { + console.log("следующий вопрос результирующий ", (nextQuestion.type === "result")) setCurrentQuestion(nextQuestion); } else { - showResult(); + console.log("следующий вопрос результирующий ", (nextQuestion.type === "result")) + showResult(nextQuestion); } return; diff --git a/src/pages/ViewPublicationPage/Question.tsx b/src/pages/ViewPublicationPage/Question.tsx index 89a7c9a7..a0e9128a 100644 --- a/src/pages/ViewPublicationPage/Question.tsx +++ b/src/pages/ViewPublicationPage/Question.tsx @@ -65,37 +65,46 @@ export const Question = ({ questions }: QuestionProps) => { const QuestionComponent = QUESTIONS_MAP[currentQuestion.type as Exclude]; + console.log("showResultForm " , showResultForm) return ( - - {!showContactForm && !showResultForm && ( + {!showContactForm && !showResultForm && ( + - )} - {showContactForm && ( - - )} - {showResultForm && ( - - )} - + + )} + {showResultForm && quiz?.config.resultInfo.when === "before" && ( + + )} + {showContactForm && ( + + )} + {showResultForm && quiz?.config.resultInfo.when === "after" && ( + + )} {!showContactForm && !showResultForm && (