diff --git a/src/pages/ResultPage/ResultSettings.tsx b/src/pages/ResultPage/ResultSettings.tsx index 65a40fd7..e583995e 100644 --- a/src/pages/ResultPage/ResultSettings.tsx +++ b/src/pages/ResultPage/ResultSettings.tsx @@ -18,7 +18,7 @@ import { ResultCard, checkEmptyData } from "./cards/ResultCard"; import { EmailSettingsCard } from "./cards/EmailSettingsCard"; import { useCurrentQuiz } from "@root/quizes/hooks"; import { useQuestionsStore } from "@root/questions/store"; -import { deleteQuestion } from "@root/questions/actions"; +import { createResult, deleteQuestion } from "@root/questions/actions"; import { QuizQuestionResult } from "@model/questionTypes/result"; import IconPlus from "@icons/IconPlus"; @@ -57,6 +57,13 @@ export const ResultSettings = () => { ); useEffect(() => { + //Всегда должен существовать хоть 1 резулт - "line" + if ( + !questions?.find( (q) => (q.type === "result" && q.content.rule.parentId === "line")) + ) { + createResult(quiz?.backendId, "line"); + console.log("Я не нашёл линейный резулт и собираюсь создать новый"); + } return () => { if (!isReadyToLeaveRef.current && window.location.pathname !== "/edit") { setOpenNotificationModal(true); diff --git a/src/pages/Tariffs/Tariffs.tsx b/src/pages/Tariffs/Tariffs.tsx index 2d619642..8ad4d2b4 100644 --- a/src/pages/Tariffs/Tariffs.tsx +++ b/src/pages/Tariffs/Tariffs.tsx @@ -15,7 +15,7 @@ import { Typography, useMediaQuery, useTheme, - IconButton + IconButton, } from "@mui/material"; import { enqueueSnackbar } from "notistack"; import { Tariff, getMessageFromFetchError } from "@frontend/kitui"; @@ -58,8 +58,8 @@ function TariffPage() { setUser(user); setTariffs(tariffs); setDiscounts(discounts.Discounts); - let c = currencyFormatter.format(Number(user.wallet.cash) / 100) - setCash(c) + let c = currencyFormatter.format(Number(user.wallet.cash) / 100); + setCash(c); }; get(); }, []); @@ -85,9 +85,8 @@ function TariffPage() { method: "POST", url: "https://squiz.pena.digital/customer/cart/pay", }); - setCash(currencyFormatter.format(Number(data.wallet.cash) / 100)) + setCash(currencyFormatter.format(Number(data.wallet.cash) / 100)); enqueueSnackbar("Тариф успешно приобретён"); - } catch (e) { enqueueSnackbar("Произошла ошибка. Попробуйте позже"); } @@ -98,8 +97,9 @@ function TariffPage() { // history.pushState({}, null, "https://hub.pena.digital/wallet?action=squizpay"); var link = document.createElement("a"); - link.href = `https://hub.pena.digital/payment?action=squizpay&dif=${(price - Number(user.wallet.cash)) * 100 - }`; + link.href = `https://hub.pena.digital/payment?action=squizpay&dif=${ + (price - Number(user.wallet.cash)) * 100 + }`; document.body.appendChild(link); // link.click(); } @@ -179,8 +179,9 @@ function TariffPage() { display: "grid", gap: "40px", p: "20px", - gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${isTablet ? "436px" : "360px" - }))`, + gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${ + isTablet ? "436px" : "360px" + }))`, }} > {createTariffElements( @@ -231,7 +232,7 @@ export const Tariffs = withErrorBoundary(TariffPage, { Ошибка загрузки тарифов ), - onError: () => { }, + onError: () => {}, }); const LoadingPage = () => ( @@ -269,7 +270,7 @@ export const inCart = () => { } }); } else { - localStorage.setItem("saveCart", "[]") + localStorage.setItem("saveCart", "[]"); } }; const outCart = (cart: string[]) => { diff --git a/src/pages/ViewPublicationPage/ContactForm.tsx b/src/pages/ViewPublicationPage/ContactForm.tsx index 33a11260..5e9a9f63 100644 --- a/src/pages/ViewPublicationPage/ContactForm.tsx +++ b/src/pages/ViewPublicationPage/ContactForm.tsx @@ -114,8 +114,6 @@ export const ContactForm = ({ borderRadius: "4px", overflow: "auto", height: "90vh", - boxShadow: - "rgba(0, 0, 0, 0.2) 0px 2px 1px -1px, rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px", }} > @@ -133,6 +131,7 @@ export const ContactForm = ({ {quiz?.config.formContact.desc && ( - + С  Положением об обработке персональных данных  и  @@ -328,7 +327,9 @@ const CustomInput = ({ title, desc, Icon }: any) => { const isMobile = useMediaQuery(theme.breakpoints.down(600)); return ( - {title} + + {title} + { + console.log("Следующий результат будет вот такой", nextQuestion); if (nextQuestion && quiz?.config.resultInfo.when === "email") { setShowContactForm(true); return; @@ -241,6 +242,7 @@ export const Footer = ({ }; const followNextStep = () => { + console.log(" Я понимаю что нахожусь в линейном опроснике" + linear); if (linear) { setStepNumber((q) => q + 1); const questionIndex = questions.findIndex(({ id }) => id === question.id); diff --git a/src/pages/ViewPublicationPage/Question.tsx b/src/pages/ViewPublicationPage/Question.tsx index 2bb555dd..fe54fce5 100644 --- a/src/pages/ViewPublicationPage/Question.tsx +++ b/src/pages/ViewPublicationPage/Question.tsx @@ -90,15 +90,17 @@ export const Question = ({ questions }: QuestionProps) => { }} > - {mode[quiz.config.theme] ? ( - - ) : ( - - )} + + {mode[quiz.config.theme] ? ( + + ) : ( + + )} + )} {showResultForm && quiz?.config.resultInfo.when === "before" && ( diff --git a/src/pages/ViewPublicationPage/ResultForm.tsx b/src/pages/ViewPublicationPage/ResultForm.tsx index 223e0e66..357a9afa 100644 --- a/src/pages/ViewPublicationPage/ResultForm.tsx +++ b/src/pages/ViewPublicationPage/ResultForm.tsx @@ -1,4 +1,10 @@ -import { Box, Typography, Button } from "@mui/material"; +import { + Box, + Typography, + Button, + useMediaQuery, + useTheme, +} from "@mui/material"; import { getQuestionByContentId } from "@root/questions/actions"; import { useCurrentQuiz } from "@root/quizes/hooks"; @@ -24,16 +30,33 @@ export const ResultForm = ({ }: ResultFormProps) => { const quiz = useCurrentQuiz(); const mode = modes; + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down(650)); const { questions } = useQuestionsStore(); - const resultQuestion = (questions.find( - (question) => - question.type === "result" && - question.content.rule.parentId === currentQuestion.content.id, - ) || - questions.find( - (question) => - question.type === "result" && question.content.rule.parentId === "line", - )) as AnyTypedQuizQuestion; + + const searchResult = () => { + if (Boolean(quiz?.config.haveRoot)) { + //ищём для ветвления + return (questions.find( + (question) => + question.type === "result" && + question.content.rule.parentId === currentQuestion.content.id, + ) || + questions.find( + (question) => + question.type === "result" && + question.content.rule.parentId === "line", + )) as AnyTypedQuizQuestion; + } else { + return questions.find( + (question) => + question.type === "result" && + question.content.rule.parentId === "line", + ) as AnyTypedQuizQuestion; + } + }; + + const resultQuestion = searchResult(); const followNextForm = () => { setShowResultForm(false); @@ -41,6 +64,7 @@ export const ResultForm = ({ }; if (resultQuestion === undefined) return <>; + console.log("Я форма показа резултата и он такой ", resultQuestion); return ( {!resultQuestion?.content.useImage && resultQuestion.content.video && ( )} @@ -75,10 +100,10 @@ export const ResultForm = ({ component="img" src={resultQuestion.content.back} sx={{ - width: "490px", - height: "280px", + width: isMobile ? "100%" : "490px", + height: isMobile ? "100%" : "280px", }} - > + /> )} {resultQuestion.description !== "" && resultQuestion.description !== " " && ( @@ -87,6 +112,7 @@ export const ResultForm = ({ fontSize: "23px", fontWeight: 700, m: "20px 0", + color: theme.palette.text.primary, }} > {resultQuestion.description} @@ -97,6 +123,7 @@ export const ResultForm = ({ {resultQuestion.title} @@ -109,6 +136,7 @@ export const ResultForm = ({ sx={{ fontSize: "18px", m: "20px 0", + color: theme.palette.text.primary, }} > {resultQuestion.content.text} @@ -130,9 +158,15 @@ export const ResultForm = ({ display: "flex", alignItems: "center", mt: "15px", + gap: "10px", }} > - + { const mode = modes; const { isMobileDevice } = useUADevice(); const isMobile = useMediaQuery(theme.breakpoints.down(650)); + const isTablet = useMediaQuery(theme.breakpoints.down(1000)); if (!quiz) return null; @@ -100,7 +101,6 @@ export const StartPageViewPublication = ({ setVisualStartPage }: Props) => { ? "linear-gradient(180deg,transparent,#272626)" : "linear-gradient(270deg,#272626,transparent)" : theme.palette.background.default, - color: quiz.config.startpageType === "expanded" ? "white" : "black", }} > @@ -197,6 +197,10 @@ export const StartPageViewPublication = ({ setVisualStartPage }: Props) => { quiz.config.startpageType === "centered" ? "center" : "-moz-initial", + color: + quiz.config.startpageType === "expanded" && !isMobile + ? "white" + : theme.palette.text.primary, }} > {quiz.config.startpage.description} @@ -229,10 +233,10 @@ export const StartPageViewPublication = ({ setVisualStartPage }: Props) => { sx={{ mt: "46px", display: "flex", - alignItems: "center", + alignItems: isTablet ? "start" : "center", justifyContent: "space-between", width: "100%", - flexDirection: isMobile ? "column" : "row", + flexDirection: isTablet ? "column" : "row", }} > @@ -272,7 +276,11 @@ export const StartPageViewPublication = ({ setVisualStartPage }: Props) => { width: "100%", overflowWrap: "break-word", fontSize: "12px", - textAlign: "end", + textAlign: isTablet ? "start" : "end", + color: + quiz.config.startpageType === "expanded" && !isMobile + ? "white" + : theme.palette.text.primary, }} > {quiz.config.info.law} diff --git a/src/pages/ViewPublicationPage/questions/Variant.tsx b/src/pages/ViewPublicationPage/questions/Variant.tsx index 12883911..bcd9e650 100644 --- a/src/pages/ViewPublicationPage/questions/Variant.tsx +++ b/src/pages/ViewPublicationPage/questions/Variant.tsx @@ -9,6 +9,7 @@ import { Checkbox, TextField, useTheme, + useMediaQuery, } from "@mui/material"; import { @@ -43,6 +44,7 @@ type VariantItemProps = { export const Variant = ({ currentQuestion }: VariantProps) => { const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down(650)); const { answers, ownVariants } = useQuizViewStore(); const { answer } = answers.find( @@ -65,7 +67,13 @@ export const Variant = ({ currentQuestion }: VariantProps) => { {currentQuestion.title} - + )} - {currentStep === 1 && ( + {currentStep <= 1 && ( state.currentStep); const isBranchingLogic = useMediaQuery(theme.breakpoints.down(1100)); const isMobile = useMediaQuery(theme.breakpoints.down(660)); - const [nextStep, setNextStep] = useState(0); const quizConfig = quiz?.config; // const [openBranchingPage, setOpenBranchingPage] = useState(false); diff --git a/src/stores/uiTools/actions.ts b/src/stores/uiTools/actions.ts index 2f3cd9cd..2ec4526e 100644 --- a/src/stores/uiTools/actions.ts +++ b/src/stores/uiTools/actions.ts @@ -40,3 +40,6 @@ export const setShowConfirmLeaveModal = (showConfirmLeaveModal: boolean) => export const updateSomeWorkBackend = (someWorkBackend: boolean) => useUiTools.setState({ someWorkBackend }); + +export const updateNextStep = (nextStep: number) => + useUiTools.setState({ nextStep }); diff --git a/src/stores/uiTools/store.ts b/src/stores/uiTools/store.ts index 3d297e39..122ccbf9 100644 --- a/src/stores/uiTools/store.ts +++ b/src/stores/uiTools/store.ts @@ -12,6 +12,7 @@ export type UiTools = { deleteNodeId: string | null; showConfirmLeaveModal: boolean; someWorkBackend: boolean; + nextStep: number }; export type WhyCantCreatePublic = { @@ -30,6 +31,7 @@ const initialState: UiTools = { deleteNodeId: null, showConfirmLeaveModal: false, someWorkBackend: false, + nextStep: -1 }; export const useUiTools = create()( diff --git a/src/ui_kit/Header/Header.tsx b/src/ui_kit/Header/Header.tsx index 9098bccd..d805d4aa 100644 --- a/src/ui_kit/Header/Header.tsx +++ b/src/ui_kit/Header/Header.tsx @@ -131,7 +131,6 @@ export const Header = ({ setMobileSidebar }: HeaderProps) => { /> ) : ( <> - { gap: "15px", }} > + diff --git a/src/ui_kit/Header/HeaderFull.tsx b/src/ui_kit/Header/HeaderFull.tsx index 8da43757..23284a29 100644 --- a/src/ui_kit/Header/HeaderFull.tsx +++ b/src/ui_kit/Header/HeaderFull.tsx @@ -58,7 +58,7 @@ export default function HeaderFull() { - + { overflow: "hidden", pointerEvents: "auto", borderRadius: "5px", + boxShadow: "0px 5px 10px 2px rgba(34, 60, 80, 0.2)", }} >