добавлена метрика ВП ЯМ
This commit is contained in:
parent
fcf4a13cc2
commit
a900035409
@ -43,6 +43,30 @@ function QuizAnswererInner({ quizSettings, quizId, preview = false, changeFavico
|
|||||||
refreshInterval: 0,
|
refreshInterval: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
//@ts-ignore
|
||||||
|
let YM = window?.ym;
|
||||||
|
//@ts-ignore
|
||||||
|
let VP = window?._tmr;
|
||||||
|
if (YM !== undefined && quizSettings?.settings.cfg.yandexMetricNumber !== undefined) {
|
||||||
|
YM(
|
||||||
|
quizSettings.settings.cfg.yandexMetricNumber,
|
||||||
|
"reachGoal",
|
||||||
|
"penaquiz-start"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (VP !== undefined && quizSettings?.settings.cfg.vkMetricNumber !== undefined) {
|
||||||
|
VP.push({
|
||||||
|
type: "reachGoal",
|
||||||
|
id: quizSettings.settings.cfg.vkMetricNumber,
|
||||||
|
goal: "penaquiz-start"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}, 4000)
|
||||||
|
}, [])
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (rootContainerRef.current) setRootContainerWidth(rootContainerRef.current.clientWidth);
|
if (rootContainerRef.current) setRootContainerWidth(rootContainerRef.current.clientWidth);
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import {useEffect, useRef, useState,} from "react";
|
import { useEffect, useRef, useState, } from "react";
|
||||||
import {Box, Button, Link, Typography, useTheme,} from "@mui/material";
|
import { Box, Button, Link, Typography, useTheme, } from "@mui/material";
|
||||||
|
|
||||||
import CustomCheckbox from "@ui_kit/CustomCheckbox.tsx";
|
import CustomCheckbox from "@ui_kit/CustomCheckbox.tsx";
|
||||||
|
|
||||||
import {DESIGN_LIST} from "@utils/designList.ts";
|
import { DESIGN_LIST } from "@utils/designList.ts";
|
||||||
import {sendFC, SendFCParams} from "@api/quizRelase.ts";
|
import { sendFC, SendFCParams } from "@api/quizRelase.ts";
|
||||||
import {useQuizData} from "@contexts/QuizDataContext.ts";
|
import { useQuizData } from "@contexts/QuizDataContext.ts";
|
||||||
import {NameplateLogo} from "@icons/NameplateLogo.tsx";
|
import { NameplateLogo } from "@icons/NameplateLogo.tsx";
|
||||||
import {QuizQuestionResult} from "@model/questionTypes/result.ts";
|
import { QuizQuestionResult } from "@model/questionTypes/result.ts";
|
||||||
import {AnyTypedQuizQuestion} from "@model/questionTypes/shared.ts";
|
import { AnyTypedQuizQuestion } from "@model/questionTypes/shared.ts";
|
||||||
import {quizThemes} from "@utils/themes/Publication/themePublication.ts";
|
import { quizThemes } from "@utils/themes/Publication/themePublication.ts";
|
||||||
import {enqueueSnackbar} from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
import {useRootContainerSize} from "@contexts/RootContainerWidthContext.ts";
|
import { useRootContainerSize } from "@contexts/RootContainerWidthContext.ts";
|
||||||
import {
|
import {
|
||||||
FormContactFieldData,
|
FormContactFieldData,
|
||||||
FormContactFieldName,
|
FormContactFieldName,
|
||||||
@ -19,7 +19,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
Inputs
|
Inputs
|
||||||
} from "@/components/ViewPublicationPage/ContactForm/Inputs/Inputs.tsx";
|
} from "@/components/ViewPublicationPage/ContactForm/Inputs/Inputs.tsx";
|
||||||
import {EMAIL_REGEXP} from "@utils/emailRegexp.tsx";
|
import { EMAIL_REGEXP } from "@utils/emailRegexp.tsx";
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@ -141,7 +141,25 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
const sessions = JSON.parse(localStorage.getItem("sessions") || "{}");
|
const sessions = JSON.parse(localStorage.getItem("sessions") || "{}");
|
||||||
sessions[quizId] = Date.now();
|
sessions[quizId] = Date.now();
|
||||||
localStorage.setItem("sessions", JSON.stringify(sessions));
|
localStorage.setItem("sessions", JSON.stringify(sessions));
|
||||||
enqueueSnackbar("Данные успешно отправлены");
|
|
||||||
|
//@ts-ignore
|
||||||
|
let YM = window?.ym;
|
||||||
|
//@ts-ignore
|
||||||
|
let VP = window?._tmr;
|
||||||
|
if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) {
|
||||||
|
YM(
|
||||||
|
settings.cfg.yandexMetricNumber,
|
||||||
|
"reachGoal",
|
||||||
|
"penaquiz-contacts"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) {
|
||||||
|
VP.push({
|
||||||
|
type: "reachGoal",
|
||||||
|
id: settings.cfg.vkMetricNumber,
|
||||||
|
goal: "penaquiz-contacts"
|
||||||
|
});
|
||||||
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
enqueueSnackbar("повторите попытку позже");
|
enqueueSnackbar("повторите попытку позже");
|
||||||
}
|
}
|
||||||
@ -152,6 +170,26 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
|
|
||||||
setFire(false);
|
setFire(false);
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
//@ts-ignore
|
||||||
|
let YM = window?.ym;
|
||||||
|
//@ts-ignore
|
||||||
|
let VP = window?._tmr;
|
||||||
|
if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) {
|
||||||
|
YM(
|
||||||
|
settings.cfg.yandexMetricNumber,
|
||||||
|
"reachGoal",
|
||||||
|
"penaquiz-form"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) {
|
||||||
|
VP.push({
|
||||||
|
type: "reachGoal",
|
||||||
|
id: settings.cfg.vkMetricNumber,
|
||||||
|
goal: "penaquiz-form"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -175,8 +213,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
settings.cfg.design && !isMobile
|
settings.cfg.design && !isMobile
|
||||||
? quizThemes[settings.cfg.theme].isLight
|
? quizThemes[settings.cfg.theme].isLight
|
||||||
? `url(${DESIGN_LIST[settings.cfg.theme]})`
|
? `url(${DESIGN_LIST[settings.cfg.theme]})`
|
||||||
: `linear-gradient(90deg, #272626, transparent), url(${
|
: `linear-gradient(90deg, #272626, transparent), url(${DESIGN_LIST[settings.cfg.theme]
|
||||||
DESIGN_LIST[settings.cfg.theme]
|
|
||||||
})`
|
})`
|
||||||
: null,
|
: null,
|
||||||
}}
|
}}
|
||||||
@ -290,7 +327,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
}}
|
}}
|
||||||
checked={ready}
|
checked={ready}
|
||||||
colorIcon={theme.palette.primary.main}
|
colorIcon={theme.palette.primary.main}
|
||||||
sx={{marginRight: "0"}}
|
sx={{ marginRight: "0" }}
|
||||||
/>
|
/>
|
||||||
<Typography sx={{ color: theme.palette.text.primary, lineHeight: "18.96px" }} fontSize={"16px"} >
|
<Typography sx={{ color: theme.palette.text.primary, lineHeight: "18.96px" }} fontSize={"16px"} >
|
||||||
С 
|
С 
|
||||||
@ -334,8 +371,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
<Box
|
<Box
|
||||||
component={Link}
|
component={Link}
|
||||||
target={"_blank"}
|
target={"_blank"}
|
||||||
href={`https://${
|
href={`https://${window.location.hostname.includes("s") ? "s" : ""
|
||||||
window.location.hostname.includes("s") ? "s" : ""
|
|
||||||
}quiz.pena.digital/squiz/quiz/logo?q=${quizId}`}
|
}quiz.pena.digital/squiz/quiz/logo?q=${quizId}`}
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
@ -35,7 +35,6 @@ export const Inputs = ({
|
|||||||
setAdress,
|
setAdress,
|
||||||
}: InputsProps) => {
|
}: InputsProps) => {
|
||||||
const { settings } = useQuizData();
|
const { settings } = useQuizData();
|
||||||
console.log('phone',phone)
|
|
||||||
const FC = settings.cfg.formContact.fields;
|
const FC = settings.cfg.formContact.fields;
|
||||||
|
|
||||||
if (!FC) return null;
|
if (!FC) return null;
|
||||||
|
@ -9,6 +9,7 @@ import { useRootContainerSize } from "../../contexts/RootContainerWidthContext";
|
|||||||
import type { QuizQuestionResult } from "../../model/questionTypes/result";
|
import type { QuizQuestionResult } from "../../model/questionTypes/result";
|
||||||
import { useQuizViewStore } from "@/stores/quizView";
|
import { useQuizViewStore } from "@/stores/quizView";
|
||||||
import { DESIGN_LIST } from "@/utils/designList";
|
import { DESIGN_LIST } from "@/utils/designList";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
type ResultFormProps = {
|
type ResultFormProps = {
|
||||||
resultQuestion: QuizQuestionResult;
|
resultQuestion: QuizQuestionResult;
|
||||||
@ -23,7 +24,27 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
(state) => state.setCurrentQuizStep
|
(state) => state.setCurrentQuizStep
|
||||||
);
|
);
|
||||||
const spec = settings.cfg.spec;
|
const spec = settings.cfg.spec;
|
||||||
console.log(quizThemes[settings.cfg.theme].isLight);
|
|
||||||
|
useEffect(() => {
|
||||||
|
//@ts-ignore
|
||||||
|
let YM = window?.ym;
|
||||||
|
//@ts-ignore
|
||||||
|
let VP = window?._tmr;
|
||||||
|
if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) {
|
||||||
|
YM(
|
||||||
|
settings.cfg.yandexMetricNumber,
|
||||||
|
"reachGoal",
|
||||||
|
`penaquiz-result-{${resultQuestion.id}}`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) {
|
||||||
|
VP.push({
|
||||||
|
type: "reachGoal",
|
||||||
|
id: settings.cfg.vkMetricNumber,
|
||||||
|
goal: `penaquiz-result-{${resultQuestion.id}}`
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -176,8 +197,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
<Box
|
<Box
|
||||||
component={Link}
|
component={Link}
|
||||||
target={"_blank"}
|
target={"_blank"}
|
||||||
href={`https://${
|
href={`https://${window.location.hostname.includes("s") ? "s" : ""
|
||||||
window.location.hostname.includes("s") ? "s" : ""
|
|
||||||
}quiz.pena.digital/squiz/quiz/logo?q=${quizId}`}
|
}quiz.pena.digital/squiz/quiz/logo?q=${quizId}`}
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
@ -8,18 +8,18 @@ import {
|
|||||||
useTheme,
|
useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
|
|
||||||
import {QuizPreviewLayoutByType} from "./QuizPreviewLayoutByType";
|
import { QuizPreviewLayoutByType } from "./QuizPreviewLayoutByType";
|
||||||
import YoutubeEmbedIframe from "../tools/YoutubeEmbedIframe";
|
import YoutubeEmbedIframe from "../tools/YoutubeEmbedIframe";
|
||||||
|
|
||||||
import {useQuizData} from "@contexts/QuizDataContext";
|
import { useQuizData } from "@contexts/QuizDataContext";
|
||||||
import {useRootContainerSize} from "@contexts/RootContainerWidthContext";
|
import { useRootContainerSize } from "@contexts/RootContainerWidthContext";
|
||||||
|
|
||||||
import {useUADevice} from "@utils/hooks/useUADevice";
|
import { useUADevice } from "@utils/hooks/useUADevice";
|
||||||
import {quizThemes} from "@utils/themes/Publication/themePublication";
|
import { quizThemes } from "@utils/themes/Publication/themePublication";
|
||||||
|
|
||||||
import {NameplateLogo} from "@icons/NameplateLogo";
|
import { NameplateLogo } from "@icons/NameplateLogo";
|
||||||
import {useQuizViewStore} from "@/stores/quizView";
|
import { useQuizViewStore } from "@/stores/quizView";
|
||||||
import {DESIGN_LIST} from "@/utils/designList";
|
import { DESIGN_LIST } from "@/utils/designList";
|
||||||
|
|
||||||
export const StartPageViewPublication = () => {
|
export const StartPageViewPublication = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@ -30,9 +30,27 @@ export const StartPageViewPublication = () => {
|
|||||||
const size = useRootContainerSize();
|
const size = useRootContainerSize();
|
||||||
const isMobile = size < 700;
|
const isMobile = size < 700;
|
||||||
const isTablet = size >= 700 && size < 1100;
|
const isTablet = size >= 700 && size < 1100;
|
||||||
|
console.log(settings)
|
||||||
const handleCopyNumber = () => {
|
const handleCopyNumber = () => {
|
||||||
navigator.clipboard.writeText(settings.cfg.info.phonenumber);
|
navigator.clipboard.writeText(settings.cfg.info.phonenumber);
|
||||||
|
//@ts-ignore
|
||||||
|
let YM = window?.ym;
|
||||||
|
//@ts-ignore
|
||||||
|
let VP = window?._tmr;
|
||||||
|
if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) {
|
||||||
|
YM(
|
||||||
|
settings.cfg.yandexMetricNumber,
|
||||||
|
"reachGoal",
|
||||||
|
"penaquiz-phone"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) {
|
||||||
|
VP.push({
|
||||||
|
type: "reachGoal",
|
||||||
|
id: settings.cfg.vkMetricNumber,
|
||||||
|
goal: "penaquiz-phone"
|
||||||
|
});
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const background =
|
const background =
|
||||||
@ -93,18 +111,18 @@ export const StartPageViewPublication = () => {
|
|||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
flexWrap: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center"? "nowrap" : "wrap",
|
flexWrap: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" ? "nowrap" : "wrap",
|
||||||
gap: isMobile? "20px" : "30px",
|
gap: isMobile ? "20px" : "30px",
|
||||||
mb: settings.cfg.startpageType === "centered" ? isMobile? "20px" : "25px" : settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" &&!isMobile ? 0 : "7px",
|
mb: settings.cfg.startpageType === "centered" ? isMobile ? "20px" : "25px" : settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && !isMobile ? 0 : "7px",
|
||||||
justifyContent: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && isMobile? "center" : undefined
|
justifyContent: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && isMobile ? "center" : undefined
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{settings.cfg.startpage.logo &&
|
{settings.cfg.startpage.logo &&
|
||||||
<img
|
<img
|
||||||
src={settings.cfg.startpage.logo}
|
src={settings.cfg.startpage.logo}
|
||||||
style={{
|
style={{
|
||||||
maxHeight: isMobile? "30px" : "40px",
|
maxHeight: isMobile ? "30px" : "40px",
|
||||||
maxWidth: isMobile? "100px" : "110px",
|
maxWidth: isMobile ? "100px" : "110px",
|
||||||
objectFit: "cover",
|
objectFit: "cover",
|
||||||
}}
|
}}
|
||||||
alt=""
|
alt=""
|
||||||
@ -117,7 +135,7 @@ export const StartPageViewPublication = () => {
|
|||||||
settings.cfg.startpageType === "expanded"
|
settings.cfg.startpageType === "expanded"
|
||||||
? "white"
|
? "white"
|
||||||
: theme.palette.text.primary,
|
: theme.palette.text.primary,
|
||||||
wordBreak: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center"? "normal" : "break-word",
|
wordBreak: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" ? "normal" : "break-word",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{settings.cfg.info.orgname}
|
{settings.cfg.info.orgname}
|
||||||
@ -137,7 +155,7 @@ export const StartPageViewPublication = () => {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
gap: "7px",
|
gap: "7px",
|
||||||
textDecoration: "none",
|
textDecoration: "none",
|
||||||
marginLeft: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && !isTablet &&!isMobile ? "61px" : undefined
|
marginLeft: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && !isTablet && !isMobile ? "61px" : undefined
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NameplateLogo
|
<NameplateLogo
|
||||||
@ -197,7 +215,7 @@ export const StartPageViewPublication = () => {
|
|||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
justifyContent: settings.cfg.startpageType === "standard" && isMobile? "start" : "center",
|
justifyContent: settings.cfg.startpageType === "standard" && isMobile ? "start" : "center",
|
||||||
flexGrow: settings.cfg.startpageType === "centered" ? 0 : 1,
|
flexGrow: settings.cfg.startpageType === "centered" ? 0 : 1,
|
||||||
alignItems:
|
alignItems:
|
||||||
settings.cfg.startpageType === "centered"
|
settings.cfg.startpageType === "centered"
|
||||||
@ -208,7 +226,7 @@ export const StartPageViewPublication = () => {
|
|||||||
: "start"
|
: "start"
|
||||||
: "start",
|
: "start",
|
||||||
marginTop: settings.cfg.startpageType === "centered" ? "30px" : isMobile ? "0px" : "5px",
|
marginTop: settings.cfg.startpageType === "centered" ? "30px" : isMobile ? "0px" : "5px",
|
||||||
maxWidth: isMobile? "100%" : settings.cfg.startpageType === "centered" ? "700px" : isTablet && settings.cfg.startpageType !== "expanded" && settings.cfg.startpage.position !== "center" ? "380px" : "531px",
|
maxWidth: isMobile ? "100%" : settings.cfg.startpageType === "centered" ? "700px" : isTablet && settings.cfg.startpageType !== "expanded" && settings.cfg.startpage.position !== "center" ? "380px" : "531px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
@ -269,7 +287,29 @@ export const StartPageViewPublication = () => {
|
|||||||
background: theme.palette.primary.main,
|
background: theme.palette.primary.main,
|
||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
}}
|
}}
|
||||||
onClick={() => setCurrentQuizStep("question")}
|
onClick={() => {
|
||||||
|
setCurrentQuizStep("question")
|
||||||
|
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
let YM = window?.ym;
|
||||||
|
//@ts-ignore
|
||||||
|
let VP = window?._tmr;
|
||||||
|
if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) {
|
||||||
|
YM(
|
||||||
|
settings.cfg.yandexMetricNumber,
|
||||||
|
"reachGoal",
|
||||||
|
"penaquiz-startquiz"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) {
|
||||||
|
VP.push({
|
||||||
|
type: "reachGoal",
|
||||||
|
id: settings.cfg.vkMetricNumber,
|
||||||
|
goal: "penaquiz-startquiz"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{settings.cfg.startpage.button.trim()
|
{settings.cfg.startpage.button.trim()
|
||||||
? settings.cfg.startpage.button
|
? settings.cfg.startpage.button
|
||||||
@ -287,7 +327,7 @@ export const StartPageViewPublication = () => {
|
|||||||
? 0
|
? 0
|
||||||
: 1
|
: 1
|
||||||
: 0,
|
: 0,
|
||||||
gap: isMobile? "30px" : "40px",
|
gap: isMobile ? "30px" : "40px",
|
||||||
alignItems: "flex-end",
|
alignItems: "flex-end",
|
||||||
justifyContent: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && isMobile || settings.cfg.startpageType === "centered" && isMobile ? "center" : "space-between",
|
justifyContent: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && isMobile || settings.cfg.startpageType === "centered" && isMobile ? "center" : "space-between",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
@ -295,13 +335,40 @@ export const StartPageViewPublication = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && !isMobile && quizHeaderBlock}
|
{settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && !isMobile && quizHeaderBlock}
|
||||||
<Box sx={{ maxWidth: "300px",
|
<Box sx={{
|
||||||
|
maxWidth: "300px",
|
||||||
display: settings.cfg.startpageType === "centered" && isMobile || settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && isMobile ? "flex" : "block",
|
display: settings.cfg.startpageType === "centered" && isMobile || settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" && isMobile ? "flex" : "block",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
order: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center"? "2" : "0"}}>
|
order: settings.cfg.startpageType === "expanded" && settings.cfg.startpage.position === "center" ? "2" : "0"
|
||||||
|
}}>
|
||||||
{settings.cfg.info.site && (
|
{settings.cfg.info.site && (
|
||||||
<Link href={settings.cfg.info.site}
|
<ButtonBase
|
||||||
|
onClick={async () => {
|
||||||
|
//@ts-ignore
|
||||||
|
let YM = window?.ym;
|
||||||
|
//@ts-ignore
|
||||||
|
let VP = window?._tmr;
|
||||||
|
if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) {
|
||||||
|
await YM(
|
||||||
|
settings.cfg.yandexMetricNumber,
|
||||||
|
"reachGoal",
|
||||||
|
"penaquiz-email"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) {
|
||||||
|
await VP.push({
|
||||||
|
type: "reachGoal",
|
||||||
|
id: settings.cfg.vkMetricNumber,
|
||||||
|
goal: "penaquiz-email"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
location.href = (
|
||||||
|
settings.cfg.info.site.includes("https")
|
||||||
|
? settings.cfg.info.site
|
||||||
|
: `https://${settings.cfg.info.site}`
|
||||||
|
).replace(/\s+/g, '')
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
@ -316,7 +383,8 @@ export const StartPageViewPublication = () => {
|
|||||||
>
|
>
|
||||||
{settings.cfg.info.site}
|
{settings.cfg.info.site}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Link>
|
</ButtonBase>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
{settings.cfg.info.clickable ? (
|
{settings.cfg.info.clickable ? (
|
||||||
isMobileDevice ? (
|
isMobileDevice ? (
|
||||||
|
@ -75,6 +75,7 @@ export default function ViewPublicationPage() {
|
|||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
let quizStepElement: ReactElement;
|
let quizStepElement: ReactElement;
|
||||||
switch (currentQuizStep) {
|
switch (currentQuizStep) {
|
||||||
case "startpage": {
|
case "startpage": {
|
||||||
|
@ -47,8 +47,6 @@ export const UploadFile = ({
|
|||||||
const uploadFile = async (file: File | undefined) => {
|
const uploadFile = async (file: File | undefined) => {
|
||||||
if (isSending) return;
|
if (isSending) return;
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
console.log(file.size);
|
|
||||||
console.log(MAX_FILE_SIZE);
|
|
||||||
if (file.size > MAX_FILE_SIZE) return setModalWarningType("errorSize");
|
if (file.size > MAX_FILE_SIZE) return setModalWarningType("errorSize");
|
||||||
|
|
||||||
const isFileTypeAccepted = ACCEPT_SEND_FILE_TYPES_MAP[
|
const isFileTypeAccepted = ACCEPT_SEND_FILE_TYPES_MAP[
|
||||||
@ -68,7 +66,6 @@ export const UploadFile = ({
|
|||||||
},
|
},
|
||||||
qid: quizId,
|
qid: quizId,
|
||||||
});
|
});
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
await sendAnswer({
|
await sendAnswer({
|
||||||
questionId: currentQuestion.id,
|
questionId: currentQuestion.id,
|
||||||
@ -85,7 +82,7 @@ export const UploadFile = ({
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
enqueueSnackbar("ответ не был засчитан");
|
enqueueSnackbar("ответ не был засчитан");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ export const VariantItem = ({
|
|||||||
currentQuestion.content.variants[index].points || 0
|
currentQuestion.content.variants[index].points || 0
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
enqueueSnackbar("ответ не был засчитан");
|
enqueueSnackbar("ответ не был засчитан");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ export const VariantItem = ({
|
|||||||
: currentQuestion.content.variants[index].points || 0
|
: currentQuestion.content.variants[index].points || 0
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
enqueueSnackbar("ответ не был засчитан");
|
enqueueSnackbar("ответ не был засчитан");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ export const VariantItem = ({
|
|||||||
preview,
|
preview,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
enqueueSnackbar("ответ не был засчитан");
|
enqueueSnackbar("ответ не был засчитан");
|
||||||
}
|
}
|
||||||
deleteAnswer(currentQuestion.id);
|
deleteAnswer(currentQuestion.id);
|
||||||
|
@ -17,6 +17,7 @@ export function useQuestionFlowControl() {
|
|||||||
const setCurrentQuizStep = useQuizViewStore(state => state.setCurrentQuizStep);
|
const setCurrentQuizStep = useQuizViewStore(state => state.setCurrentQuizStep);
|
||||||
|
|
||||||
const currentQuestion = sortedQuestions.find(question => question.id === currentQuestionId) ?? sortedQuestions[0];
|
const currentQuestion = sortedQuestions.find(question => question.id === currentQuestionId) ?? sortedQuestions[0];
|
||||||
|
console.log("currentQuestion", currentQuestion)
|
||||||
|
|
||||||
const linearQuestionIndex = currentQuestion && sortedQuestions.every(({ content }) => content.rule.parentId !== "root") // null when branching enabled
|
const linearQuestionIndex = currentQuestion && sortedQuestions.every(({ content }) => content.rule.parentId !== "root") // null when branching enabled
|
||||||
? sortedQuestions.indexOf(currentQuestion)
|
? sortedQuestions.indexOf(currentQuestion)
|
||||||
@ -149,6 +150,26 @@ export function useQuestionFlowControl() {
|
|||||||
if (!nextQuestion) throw new Error("Next question not found");
|
if (!nextQuestion) throw new Error("Next question not found");
|
||||||
|
|
||||||
if (nextQuestion.type === "result") return showResult();
|
if (nextQuestion.type === "result") return showResult();
|
||||||
|
//засчитываем переход с вопроса дальше
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
let YM = window?.ym;
|
||||||
|
//@ts-ignore
|
||||||
|
let VP = window?._tmr;
|
||||||
|
if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) {
|
||||||
|
YM(
|
||||||
|
settings.cfg.yandexMetricNumber,
|
||||||
|
"reachGoal",
|
||||||
|
`penaquiz-step{${currentQuestion.id}}`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) {
|
||||||
|
VP.push({
|
||||||
|
type: "reachGoal",
|
||||||
|
id: settings.cfg.vkMetricNumber,
|
||||||
|
goal: `penaquiz-step{${currentQuestion.id}}`
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
setCurrentQuestionId(nextQuestion.id);
|
setCurrentQuestionId(nextQuestion.id);
|
||||||
}, [nextQuestion, showResult]);
|
}, [nextQuestion, showResult]);
|
||||||
|
Loading…
Reference in New Issue
Block a user