diff --git a/lib/assets/icons/CorrectAnswer.tsx b/lib/assets/icons/CorrectAnswer.tsx new file mode 100644 index 0000000..f059f88 --- /dev/null +++ b/lib/assets/icons/CorrectAnswer.tsx @@ -0,0 +1,39 @@ +import { Box, SxProps } from "@mui/material"; + +type Props = { + sx?: SxProps; +}; + +export const CorrectAnswer = ({ sx }: Props) => { + return ( + + + + + + + ); +}; diff --git a/lib/assets/icons/IncorrectAnswer.tsx b/lib/assets/icons/IncorrectAnswer.tsx new file mode 100644 index 0000000..95473c3 --- /dev/null +++ b/lib/assets/icons/IncorrectAnswer.tsx @@ -0,0 +1,46 @@ +import { Box, SxProps } from "@mui/material"; + +type Props = { + sx?: SxProps; +}; + +export const IncorrectAnswer = ({ sx }: Props) => { + return ( + + + + + + + + ); +}; diff --git a/lib/assets/icons/TickOpenClose.tsx b/lib/assets/icons/TickOpenClose.tsx new file mode 100644 index 0000000..39dbc24 --- /dev/null +++ b/lib/assets/icons/TickOpenClose.tsx @@ -0,0 +1,45 @@ +import { Box, SxProps } from "@mui/material"; + +type Props = { + checked?: boolean; + sx?: SxProps; +}; + +export const TickOpenClose = ({ checked = false, sx }: Props) => { + return ( + + + + + + + ); +}; diff --git a/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx b/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx index 6ce5068..d38ed5e 100644 --- a/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx +++ b/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx @@ -24,6 +24,7 @@ import { NameplateLogo } from "@icons/NameplateLogo"; import type { FormContactFieldData, FormContactFieldName } from "@model/settingsData"; import type { QuizQuestionResult } from "@model/questionTypes/result"; import type { AnyTypedQuizQuestion } from "@model/questionTypes/shared"; +import { isProduction } from "@/utils/defineDomain"; type Props = { currentQuestion: AnyTypedQuizQuestion; @@ -315,9 +316,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => { { + const theme = useTheme(); + const { questions } = useQuizSettings(); + const answers = useQuizViewStore((state) => state.answers); + + const questionsWothoutResult = questions.filter( + (q: AnyTypedQuizQuestion): q is QuizQuestionVariant => q.type === "variant" + ); + + return questionsWothoutResult.map((currentQuestion) => { + let answerIndex = 0; + let currentVariants = currentQuestion.content.variants; + + const currentAnswer = answers.find((a) => a.questionId === currentQuestion.id); + const answeredVariant = currentVariants.find((v, i) => { + if (v.id === currentAnswer?.answer) { + answerIndex = i; + return true; + } + }); + + return ( + + + + + {currentQuestion.page + 1}. + + + {currentQuestion.title || "Вопрос без названия"} + + + + {answeredVariant?.points || "0"}/10 + + + + + Ваш ответ: + + + + {/* {Boolean(answeredVariant?.points) ? : } + {answeredVariant?.answer || "не выбрано"} */} + {currentVariants.map((v) => { + if (v.id === currentAnswer?.answer) { + return <>; + } else + return ( + + ); + })} + + + + ); + }); +}; + +interface LineProps { + checkTrue: boolean; + text?: string; +} + +const Line = ({ checkTrue, text }: LineProps) => { + const theme = useTheme(); + + return ( + + {checkTrue ? : } + + {text || "не выбрано"} + + + ); +}; diff --git a/lib/components/ViewPublicationPage/ResultForm.tsx b/lib/components/ViewPublicationPage/ResultForm.tsx index cd620c6..85f206f 100644 --- a/lib/components/ViewPublicationPage/ResultForm.tsx +++ b/lib/components/ViewPublicationPage/ResultForm.tsx @@ -14,6 +14,8 @@ import { NameplateLogo } from "@icons/NameplateLogo"; import type { QuizQuestionResult } from "@/model/questionTypes/result"; import QuizVideo from "@/ui_kit/VideoIframe/VideoIframe"; +import { TextAccordion } from "./tools/TextAccordion"; +import { PointSystemResultList } from "./PointSystemResultList"; type ResultFormProps = { resultQuestion: QuizQuestionResult; @@ -185,6 +187,32 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => { {resultQuestion.content.text} )} + + Посмотреть ответы + + } + sx={{ + mt: "60px", + width: "100%", + }} + > + + + + {show_badge && ( diff --git a/lib/components/ViewPublicationPage/StartPageViewPublication/index.tsx b/lib/components/ViewPublicationPage/StartPageViewPublication/index.tsx index ecf067c..4e6ab64 100644 --- a/lib/components/ViewPublicationPage/StartPageViewPublication/index.tsx +++ b/lib/components/ViewPublicationPage/StartPageViewPublication/index.tsx @@ -16,6 +16,8 @@ import { useVkMetricsGoals } from "@/utils/hooks/metrics/useVkMetricsGoals"; import { useYandexMetricsGoals } from "@/utils/hooks/metrics/useYandexMetricsGoals"; import QuizVideo from "@/ui_kit/VideoIframe/VideoIframe"; +import { isProduction } from "@/utils/defineDomain"; + export const StartPageViewPublication = () => { const theme = useTheme(); const { settings, show_badge, quizId, questions } = useQuizSettings(); @@ -135,8 +137,7 @@ export const StartPageViewPublication = () => { { + const theme = useTheme(); + + const [open, setOpen] = useState(false); + + return ( + setOpen((old) => !old)} + > + + {headerText} + + + {open && children} + + ); +}; diff --git a/lib/utils/defineDomain.ts b/lib/utils/defineDomain.ts index ca0de96..7233775 100644 --- a/lib/utils/defineDomain.ts +++ b/lib/utils/defineDomain.ts @@ -5,8 +5,13 @@ let domain = "https://hbpn.link"; const currentDomain = location.hostname; -//туризм больше не в исключениях -if (currentDomain === "s.hbpn.link" || currentDomain.includes("localhost") || currentDomain.includes("127.0.0.1")) - domain = "https://s.hbpn.link"; +const isProduction = !( + currentDomain === "s.hbpn.link" || + currentDomain.includes("localhost") || + currentDomain.includes("127.0.0.1") +); -export { domain }; +//туризм больше не в исключениях +if (!isProduction) domain = "https://s.hbpn.link"; + +export { domain, isProduction }; diff --git a/lib/utils/hooks/useQuestionFlowControl.ts b/lib/utils/hooks/useQuestionFlowControl.ts index f8feaff..78b85f4 100644 --- a/lib/utils/hooks/useQuestionFlowControl.ts +++ b/lib/utils/hooks/useQuestionFlowControl.ts @@ -125,6 +125,7 @@ export function useQuestionFlowControl() { //Анализ результата по количеству баллов const findResultPointsLogic = useCallback(() => { //Отбираем из массива только тип резулт И результы с информацией о ожидаемых баллах И те результы, чьи суммы баллов меньше или равны насчитанным баллам юзера + const results = sortedQuestions.filter( (e) => e.type === "result" && e.content.rule.minScore !== undefined && e.content.rule.minScore <= pointsSum ); @@ -134,7 +135,6 @@ export function useQuestionFlowControl() { ); //Извлекаем самое большое число const indexOfNext = Math.max(...numbers); - //Отдаём индекс нужного нам результата return results[numbers.indexOf(indexOfNext)]; }, [pointsSum, sortedQuestions]);