diff --git a/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx b/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx index 64d3317..21bee90 100644 --- a/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx +++ b/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx @@ -26,6 +26,7 @@ import type { AnyTypedQuizQuestion } from "@model/questionTypes/shared"; import { isProduction } from "@/utils/defineDomain"; import { useQuizStore } from "@/stores/useQuizStore"; import { useTranslation } from "react-i18next"; +import { isNeftyanka } from "@/ui_kit/neftyankacrutch"; type Props = { currentQuestion: AnyTypedQuizQuestion; @@ -317,7 +318,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => { }, }} > - {settings.cfg.formContact?.button || t("Get results")} + {isNeftyanka ? t("neftyanka button") : settings.cfg.formContact?.button || t("Get results")} {show_badge && ( diff --git a/lib/components/ViewPublicationPage/ContactForm/ContactTextBlock/index.tsx b/lib/components/ViewPublicationPage/ContactForm/ContactTextBlock/index.tsx index 1240c71..62b441a 100644 --- a/lib/components/ViewPublicationPage/ContactForm/ContactTextBlock/index.tsx +++ b/lib/components/ViewPublicationPage/ContactForm/ContactTextBlock/index.tsx @@ -3,6 +3,7 @@ import { useRootContainerSize } from "@contexts/RootContainerWidthContext.ts"; import { QuizSettingsConfig } from "@model/settingsData.ts"; import { FC } from "react"; import { useTranslation } from "react-i18next"; +import { isNeftyanka } from "@/ui_kit/neftyankacrutch"; type ContactTextBlockProps = { settings: QuizSettingsConfig; @@ -47,7 +48,9 @@ export const ContactTextBlock: FC = ({ settings }) => { wordBreak: "break-word", }} > - {settings.cfg.formContact.title || t("Fill out the form to receive your test results")} + {isNeftyanka + ? t("neftyanka FK") + : settings.cfg.formContact.title || t("Fill out the form to receive your test results")} {settings.cfg.formContact.desc && ( ; // temporary fix ts(2590) + +interface TextSpecialProps { + currentQuestion: QuizQuestionText; + answer?: Answer; + stepNumber?: number | null; +} + +function highlightQuestions(text: string) { + // Регулярка с учётом возможной точки в конце + const regex = /(вопрос\s\d+[a-zA-Zа-яА-Я]\.?)/g; + + // Замена на с жирным текстом + return text.replace(regex, '$1'); +} + +export const TextNeftyanka = ({ currentQuestion, answer, stepNumber }: TextSpecialProps) => { + const { settings } = useQuizStore(); + const { updateAnswer } = useQuizViewStore((state) => state); + const isHorizontal = true; + const theme = useTheme(); + const isMobile = useRootContainerSize() < 650; + + const onInputChange = async ({ target }: ChangeEvent) => { + updateAnswer(currentQuestion.id, target.value, 0); + }; + + return ( + + + {isHorizontal && currentQuestion.content.back && currentQuestion.content.back !== " " && ( + event.preventDefault()} + > + + + )} + + {highlightQuestions(currentQuestion.title)} + + { + + } + + {!isHorizontal && currentQuestion.content.back && currentQuestion.content.back !== " " && ( + event.preventDefault()} + > + + + )} + + ); +}; diff --git a/lib/components/ViewPublicationPage/questions/Text/TextNormal.tsx b/lib/components/ViewPublicationPage/questions/Text/TextNormal.tsx index 9f40523..5a6a454 100644 --- a/lib/components/ViewPublicationPage/questions/Text/TextNormal.tsx +++ b/lib/components/ViewPublicationPage/questions/Text/TextNormal.tsx @@ -60,6 +60,7 @@ export const TextNormal = ({ currentQuestion, answer }: TextNormalProps) => { placeholder={currentQuestion.content.placeholder} value={answer || ""} onChange={onInputChange} + multiline={Boolean(currentQuestion.content?.multi)} sx={{ "& .MuiOutlinedInput-root": { background: settings.cfg.design diff --git a/lib/components/ViewPublicationPage/questions/Text/index.tsx b/lib/components/ViewPublicationPage/questions/Text/index.tsx index 081da54..6ecf3f2 100644 --- a/lib/components/ViewPublicationPage/questions/Text/index.tsx +++ b/lib/components/ViewPublicationPage/questions/Text/index.tsx @@ -5,6 +5,8 @@ import { TextSpecialHorisontal } from "./TextSpecialHorisontal"; import type { QuizQuestionText } from "@model/questionTypes/text"; import { useQuizStore } from "@/stores/useQuizStore"; +import { isNeftyanka } from "@/ui_kit/neftyankacrutch"; +import { TextNeftyanka } from "./TextNeftyanka"; type TextProps = { currentQuestion: QuizQuestionText; @@ -18,7 +20,16 @@ export const Text = ({ currentQuestion, stepNumber }: TextProps) => { const answers = useQuizViewStore((state) => state.answers); const { answer } = answers.find(({ questionId }) => questionId === currentQuestion.id) ?? {}; - if (pathOnly === "/92ed5e3e-8e6a-491e-87d0-d3197682d0e3" || pathOnly === "/cc006b40-ccbd-4600-a1d3-f902f85aa0a0") + if (isNeftyanka) + return ( + + ); + + if (pathOnly === "/92ed5e3e-8e6a-491e-87d0-d3197682d0e3") return ( ; InputProps?: Partial; + multiline: boolean; } export default function CustomTextField({ @@ -28,11 +29,16 @@ export default function CustomTextField({ onKeyDown, onBlur, InputProps, + multiline, }: CustomTextFieldProps) { const theme = useTheme(); return ( - + ); + root.render( + + ); }, };