Merge remote-tracking branch 'origin/staging'

This commit is contained in:
skeris 2024-05-08 00:02:06 +03:00
commit a04288cb58
6 changed files with 148 additions and 127 deletions

@ -20,6 +20,9 @@ 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";
import {
ContactTextBlock
} from "@/components/ViewPublicationPage/ContactForm/ContactTextBlock/ContactTextBlock.tsx";
type Props = { type Props = {
@ -143,23 +146,23 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
localStorage.setItem("sessions", JSON.stringify(sessions)); localStorage.setItem("sessions", JSON.stringify(sessions));
//@ts-ignore //@ts-ignore
let YM = window?.ym; const YM = window?.ym;
//@ts-ignore //@ts-ignore
let VP = window?._tmr; const VP = window?._tmr;
if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) { if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) {
YM( YM(
settings.cfg.yandexMetricNumber, settings.cfg.yandexMetricNumber,
"reachGoal", "reachGoal",
"penaquiz-contacts" "penaquiz-contacts"
); );
}; }
if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) { if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) {
VP.push({ VP.push({
type: "reachGoal", type: "reachGoal",
id: settings.cfg.vkMetricNumber, id: settings.cfg.vkMetricNumber,
goal: "penaquiz-contacts" goal: "penaquiz-contacts"
}); });
}; }
} catch (e) { } catch (e) {
enqueueSnackbar("повторите попытку позже"); enqueueSnackbar("повторите попытку позже");
} }
@ -172,23 +175,23 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
} }
useEffect(() => { useEffect(() => {
//@ts-ignore //@ts-ignore
let YM = window?.ym; const YM = window?.ym;
//@ts-ignore //@ts-ignore
let VP = window?._tmr; const VP = window?._tmr;
if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) { if (YM !== undefined && settings.cfg.yandexMetricNumber !== undefined) {
YM( YM(
settings.cfg.yandexMetricNumber, settings.cfg.yandexMetricNumber,
"reachGoal", "reachGoal",
"penaquiz-form" "penaquiz-form"
); );
}; }
if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) { if (VP !== undefined && settings.cfg.vkMetricNumber !== undefined) {
VP.push({ VP.push({
type: "reachGoal", type: "reachGoal",
id: settings.cfg.vkMetricNumber, id: settings.cfg.vkMetricNumber,
goal: "penaquiz-form" goal: "penaquiz-form"
}); });
}; }
}, []) }, [])
return ( return (
@ -213,7 +216,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(${DESIGN_LIST[settings.cfg.theme] : `linear-gradient(90deg, rgba(39, 38, 38, 0.95) 7.66%, rgba(42, 42, 46, 0.85) 42.12%, rgba(51, 54, 71, 0.4) 100%), url(${DESIGN_LIST[settings.cfg.theme]
})` })`
: null, : null,
}} }}
@ -231,65 +234,22 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
: theme.palette.background.default, : theme.palette.background.default,
}} }}
> >
<Box <ContactTextBlock settings={settings} />
sx={{ <Box sx={{
width: isMobile ? undefined : "100%", flexGrow: 0,
display: "flex", display: "flex",
flexDirection: "column",
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "space-between",
borderRight: isMobile ? undefined : "1px solid #9A9AAF80",
margin: isMobile ? 0 : "40px 0",
padding: isMobile ? "0" : "0 40px"
}}
>
<Box
sx={{
maxWidth: "630px",
width: "100%",
display: "flex",
flexDirection: "column", flexDirection: "column",
alignItems: "flex-start", backgroundColor: theme.palette.background.default,
justifyContent: "center", height: "auto",
padding: isMobile ? "40px 20px 0 20px" : "0", }}>
mt: isMobile ? 0 : isTablet ? "-180px" : "-47px",
}}
>
<Typography
sx={{
textAlign: isTablet ? undefined : "center",
fontSize: "24px",
lineHeight: "normal",
fontWeight: 501,
color: theme.palette.text.primary,
wordBreak: "break-word",
}}
>
{settings.cfg.formContact.title ||
"Заполните форму, чтобы получить результаты теста"}
</Typography>
{settings.cfg.formContact.desc && (
<Typography
sx={{
color: theme.palette.text.primary,
m: "20px 0",
fontSize: "18px",
wordBreak: "break-word",
}}
>
{settings.cfg.formContact.desc}
</Typography>
)}
</Box>
</Box>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
alignItems: isMobile ? undefined : "center", alignItems: isMobile ? undefined : "center",
justifyContent: "center", justifyContent: "center",
flexDirection: "column", flexDirection: "column",
backgroundColor: theme.palette.background.default,
p: isMobile ? "0 20px" : isTablet ? "0px 40px 30px 60px" : "125px 60px 30px 60px", p: isMobile ? "0 20px" : isTablet ? "0px 40px 30px 60px" : "125px 60px 30px 60px",
}} }}
> >
@ -345,9 +305,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
&ensp;ознакомлен &ensp;ознакомлен
</Typography> </Typography>
</Box> </Box>
{
// resultQuestion &&
// settings.cfg.resultInfo.when === "after" &&
<Button <Button
disabled={!(ready && !fire)} disabled={!(ready && !fire)}
variant="contained" variant="contained"
@ -366,7 +324,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
> >
{settings.cfg.formContact?.button || "Получить результаты"} {settings.cfg.formContact?.button || "Получить результаты"}
</Button> </Button>
} </Box>
{show_badge && ( {show_badge && (
<Box <Box
component={Link} component={Link}
@ -377,12 +335,9 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
mt: "55px", mt: "55px",
mb: "40px", mb: isMobile? "30px": isTablet? "40px" :"50px",
gap: "10px", gap: "10px",
textDecoration: "none", textDecoration: "none",
position: "absolute",
bottom: 0,
left: isMobile ? "28%" : undefined
}} }}
> >
<NameplateLogo <NameplateLogo
@ -393,17 +348,6 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
: "#FFFFFF", : "#FFFFFF",
}} }}
/> />
{/*<Typography*/}
{/* sx={{*/}
{/* fontSize: "14px",*/}
{/* color: quizThemes[settings.cfg.theme].isLight*/}
{/* ? "#4D4D4D"*/}
{/* : "#F5F7FF",*/}
{/* whiteSpace: "nowrap",*/}
{/* }}*/}
{/*>*/}
{/* Сделано на PenaQuiz*/}
{/*</Typography>*/}
</Box> </Box>
)} )}
</Box> </Box>

@ -0,0 +1,66 @@
import {Box, Typography, useTheme} from "@mui/material";
import {useRootContainerSize} from "@contexts/RootContainerWidthContext.ts";
import {QuizSettingsConfig} from "@model/settingsData.ts";
import {FC} from "react";
type ContactTextBlockProps = {
settings: QuizSettingsConfig;
}
export const ContactTextBlock: FC<ContactTextBlockProps> = ({settings}) => {
const theme = useTheme();
const isMobile = useRootContainerSize() < 850;
const isTablet = useRootContainerSize() < 1000;
return (
<Box
sx={{
flexGrow: 1,
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
borderRight: isMobile ? undefined : "1px solid #9A9AAF80",
margin: isMobile ? 0 : "40px 0",
padding: isMobile ? "0" : "0 40px"
}}
>
<Box
sx={{
maxWidth: isMobile? "100%" : isTablet? "410px" : "630px",
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
justifyContent: "center",
padding: isMobile ? "40px 20px 0 20px" : "0",
mt: isMobile ? 0 : isTablet ? "-180px" : "-47px",
}}
>
<Typography
sx={{
textAlign: isTablet ? undefined : "center",
fontSize: "24px",
lineHeight: "normal",
fontWeight: 501,
color: theme.palette.text.primary,
wordBreak: "break-word",
}}
>
{settings.cfg.formContact.title ||
"Заполните форму, чтобы получить результаты теста"}
</Typography>
{settings.cfg.formContact.desc && (
<Typography
sx={{
color: theme.palette.text.primary,
m: "20px 0",
fontSize: "18px",
wordBreak: "break-word",
}}
>
{settings.cfg.formContact.desc}
</Typography>
)}
</Box>
</Box>
)
}

@ -20,6 +20,13 @@ export const CountrySelector:FC<CountrySelectorProps> = ({setMask}) => {
value={country} value={country}
onChange={handleChange} onChange={handleChange}
renderValue={(value) => value} renderValue={(value) => value}
MenuProps={{
PaperProps: {
style: {
backgroundColor: theme.palette.background.default,
},
},
}}
sx={{ sx={{
minWidth: 50, minWidth: 50,
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,

@ -90,6 +90,7 @@ export default function ViewPublicationPage() {
quizStepElement = ( quizStepElement = (
<Question <Question
key={currentQuestion.id}
currentQuestion={currentQuestion} currentQuestion={currentQuestion}
currentQuestionStepNumber={currentQuestionStepNumber} currentQuestionStepNumber={currentQuestionStepNumber}
prevButton={ prevButton={

@ -100,7 +100,8 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
{answer ? ( {answer ? (
variant?.extendedText ? ( variant?.extendedText ? (
<img <img
src={variant?.extendedText} key={variant.extendedText}
src={variant.extendedText}
style={{ width: "100%", height: "100%", objectFit: "cover" }} style={{ width: "100%", height: "100%", objectFit: "cover" }}
alt="" alt=""
/> />

@ -41,9 +41,7 @@ export type FCField = {
used: boolean; used: boolean;
}; };
export type QuizSettings = { export type QuizSettingsConfig = {
questions: AnyTypedQuizQuestion[];
settings: {
fp: boolean; fp: boolean;
rep: boolean; rep: boolean;
name: string; name: string;
@ -52,7 +50,11 @@ export type QuizSettings = {
delay: number; delay: number;
pausable: boolean; pausable: boolean;
cfg: QuizConfig; cfg: QuizConfig;
}; }
export type QuizSettings = {
questions: AnyTypedQuizQuestion[];
settings: QuizSettingsConfig;
cnt: number; cnt: number;
recentlyCompleted: boolean; recentlyCompleted: boolean;
show_badge: boolean; show_badge: boolean;