From 888d4a4f67a18b4ce9771aa622a57f32c7df6edf Mon Sep 17 00:00:00 2001 From: Nastya Date: Sat, 16 Dec 2023 23:17:42 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=BD=D0=BE=D0=B5=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82=D0=BE=D0=B2=20=D0=B8?= =?UTF-8?q?=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ResultPage/cards/WhenCard.tsx | 4 +- src/pages/ViewPublicationPage/ApologyPage.tsx | 21 ++++++ src/pages/ViewPublicationPage/ContactForm.tsx | 8 ++- src/pages/ViewPublicationPage/Footer.tsx | 15 +++-- src/pages/ViewPublicationPage/Question.tsx | 65 +++++++++++-------- src/pages/ViewPublicationPage/ResultForm.tsx | 53 ++++++++------- src/pages/ViewPublicationPage/index.tsx | 2 + 7 files changed, 101 insertions(+), 67 deletions(-) create mode 100644 src/pages/ViewPublicationPage/ApologyPage.tsx 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..5e66e0af 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"; @@ -108,7 +108,9 @@ export const ContactForm = ({ ( )} @@ -145,7 +147,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 && (