Merge branch 'dev' into 'staging'
Dev See merge request frontend/squzanswerer!94
This commit is contained in:
commit
e28400aa84
@ -1,5 +1,7 @@
|
|||||||
import { GetQuizDataResponse, parseQuizData } from "@model/api/getQuizData";
|
import { GetQuizDataResponse, parseQuizData } from "@model/api/getQuizData";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import MobileDetect from 'mobile-detect';
|
||||||
|
import device from "current-device";
|
||||||
|
|
||||||
import type { AxiosError } from "axios";
|
import type { AxiosError } from "axios";
|
||||||
import { replaceSpacesToEmptyLines } from "../components/ViewPublicationPage/tools/replaceSpacesToEmptyLines";
|
import { replaceSpacesToEmptyLines } from "../components/ViewPublicationPage/tools/replaceSpacesToEmptyLines";
|
||||||
@ -9,12 +11,26 @@ let SESSIONS = "";
|
|||||||
|
|
||||||
const domain = location.hostname === "hbpn.link" ? "" : "https://s.hbpn.link";
|
const domain = location.hostname === "hbpn.link" ? "" : "https://s.hbpn.link";
|
||||||
|
|
||||||
|
const md = new MobileDetect(window.navigator.userAgent);
|
||||||
|
|
||||||
|
const userAgent = navigator.userAgent
|
||||||
|
let OSDevice = md.os()
|
||||||
|
if (OSDevice === null) {OSDevice = userAgent}
|
||||||
|
|
||||||
|
const DeviceType = device.type
|
||||||
|
let Device = md.mobile()
|
||||||
|
if (Device === null) {Device = userAgent}
|
||||||
|
|
||||||
export const publicationMakeRequest = ({ url, body }: any) => {
|
export const publicationMakeRequest = ({ url, body }: any) => {
|
||||||
return axios(url, {
|
return axios(url, {
|
||||||
data: body,
|
data: body,
|
||||||
headers: {
|
headers: {
|
||||||
"X-Sessionkey": SESSIONS,
|
"X-Sessionkey": SESSIONS,
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
|
"DeviceType" : DeviceType,
|
||||||
|
"Device" : Device,
|
||||||
|
"OS": OSDevice,
|
||||||
|
"Browser" : userAgent
|
||||||
},
|
},
|
||||||
method: "POST",
|
method: "POST",
|
||||||
});
|
});
|
||||||
@ -33,6 +49,10 @@ export async function getData(quizId: string): Promise<{
|
|||||||
headers: {
|
headers: {
|
||||||
"X-Sessionkey": SESSIONS,
|
"X-Sessionkey": SESSIONS,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
"DeviceType" : DeviceType,
|
||||||
|
"Device" : Device,
|
||||||
|
"OS": OSDevice,
|
||||||
|
"Browser" : userAgent
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
quiz_id: quizId,
|
quiz_id: quizId,
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export default function ArrowDownIcon(
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
||||||
<path d="M19.5 9L12 16.5L4.5 9" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
<path d="M19.5 9L12 16.5L4.5 9" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
||||||
</svg>
|
</svg>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -2,17 +2,23 @@ import { Box } from "@mui/material";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
color: string;
|
color: string;
|
||||||
|
backgroundColor: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AddressIcon({ color }: Props) {
|
export default function AddressIcon({ color, backgroundColor }: Props) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
// height: "38px",
|
// height: "38px",
|
||||||
// width: "45px",
|
// width: "24px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
|
height: "58px",
|
||||||
|
width: "42px",
|
||||||
|
backgroundColor: {backgroundColor},
|
||||||
|
borderBottomLeftRadius: "12px",
|
||||||
|
borderTopLeftRadius: "12px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|||||||
@ -2,17 +2,23 @@ import { Box } from "@mui/material";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
color: string;
|
color: string;
|
||||||
|
backgroundColor: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function EmailIcon({ color }: Props) {
|
export default function EmailIcon({ color, backgroundColor }: Props) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
// height: "38px",
|
// height: "38px",
|
||||||
// width: "45px",
|
// width: "24px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
|
height: "58px",
|
||||||
|
width: "42px",
|
||||||
|
backgroundColor: {backgroundColor},
|
||||||
|
borderBottomLeftRadius: "12px",
|
||||||
|
borderTopLeftRadius: "12px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|||||||
@ -2,9 +2,10 @@ import { Box } from "@mui/material";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
color: string;
|
color: string;
|
||||||
|
backgroundColor: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function NameIcon({ color }: Props) {
|
export default function NameIcon({ color, backgroundColor }: Props) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -13,6 +14,11 @@ export default function NameIcon({ color }: Props) {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
|
height: "58px",
|
||||||
|
width: "42px",
|
||||||
|
backgroundColor: {backgroundColor},
|
||||||
|
borderBottomLeftRadius: "12px",
|
||||||
|
borderTopLeftRadius: "12px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|||||||
@ -2,23 +2,29 @@ import { Box } from "@mui/material";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
color: string;
|
color: string;
|
||||||
|
backgroundColor: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PhoneIcon({ color }: Props) {
|
export default function PhoneIcon({ color, backgroundColor }: Props) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
// height: "38px",
|
// height: "38px",
|
||||||
// width: "45px",
|
// width: "24px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
|
height: "58px",
|
||||||
|
width: "42px",
|
||||||
|
backgroundColor: {backgroundColor},
|
||||||
|
borderBottomLeftRadius: "12px",
|
||||||
|
borderTopLeftRadius: "12px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
width="15"
|
width="17"
|
||||||
height="15"
|
height="17"
|
||||||
viewBox="0 0 15 15"
|
viewBox="0 0 17 17"
|
||||||
fill="none"
|
fill="none"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -2,9 +2,10 @@ import { Box } from "@mui/material";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
color: string;
|
color: string;
|
||||||
|
backgroundColor: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function TextIcon({ color }: Props) {
|
export default function TextIcon({ color, backgroundColor }: Props) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -13,6 +14,11 @@ export default function TextIcon({ color }: Props) {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
|
height: "58px",
|
||||||
|
width: "42px",
|
||||||
|
backgroundColor: {backgroundColor},
|
||||||
|
borderBottomLeftRadius: "12px",
|
||||||
|
borderTopLeftRadius: "12px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|||||||
@ -3,20 +3,29 @@ import EmailIcon from "@icons/ContactFormIcon/EmailIcon";
|
|||||||
import NameIcon from "@icons/ContactFormIcon/NameIcon";
|
import NameIcon from "@icons/ContactFormIcon/NameIcon";
|
||||||
import PhoneIcon from "@icons/ContactFormIcon/PhoneIcon";
|
import PhoneIcon from "@icons/ContactFormIcon/PhoneIcon";
|
||||||
import TextIcon from "@icons/ContactFormIcon/TextIcon";
|
import TextIcon from "@icons/ContactFormIcon/TextIcon";
|
||||||
import { Box, Button, InputAdornment, Link, TextField as MuiTextField, TextFieldProps, Typography, useTheme } from "@mui/material";
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
InputAdornment,
|
||||||
|
Link,
|
||||||
|
TextField as MuiTextField,
|
||||||
|
TextFieldProps,
|
||||||
|
Typography,
|
||||||
|
useTheme
|
||||||
|
} from "@mui/material";
|
||||||
|
|
||||||
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
||||||
import { FC, useRef, useState } from "react";
|
import {FC, useRef, useState} from "react";
|
||||||
|
|
||||||
import { sendFC } from "@api/quizRelase";
|
import {sendFC} from "@api/quizRelase";
|
||||||
import { NameplateLogo } from "@icons/NameplateLogo";
|
import {NameplateLogo} from "@icons/NameplateLogo";
|
||||||
import { QuizQuestionResult } from "@model/questionTypes/result";
|
import {QuizQuestionResult} from "@model/questionTypes/result";
|
||||||
import { AnyTypedQuizQuestion } from "@model/questionTypes/shared";
|
import {AnyTypedQuizQuestion} from "@model/questionTypes/shared";
|
||||||
import { quizThemes } from "@utils/themes/Publication/themePublication";
|
import {quizThemes} from "@utils/themes/Publication/themePublication";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import {enqueueSnackbar} from "notistack";
|
||||||
import { useRootContainerSize } from "../../contexts/RootContainerWidthContext";
|
import {useRootContainerSize} from "../../contexts/RootContainerWidthContext";
|
||||||
import { useQuizData } from "@contexts/QuizDataContext";
|
import {useQuizData} from "@contexts/QuizDataContext";
|
||||||
import { DESIGN_LIST } from "@/components/ViewPublicationPage/Question";
|
import {DESIGN_LIST} from "@/components/ViewPublicationPage/Question";
|
||||||
|
|
||||||
|
|
||||||
const TextField = MuiTextField as unknown as FC<TextFieldProps>; // temporary fix ts(2590)
|
const TextField = MuiTextField as unknown as FC<TextFieldProps>; // temporary fix ts(2590)
|
||||||
@ -27,9 +36,9 @@ type Props = {
|
|||||||
onShowResult: () => void;
|
onShowResult: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
export const ContactForm = ({currentQuestion, onShowResult}: Props) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { settings, questions, quizId, show_badge } = useQuizData();
|
const {settings, questions, quizId, show_badge} = useQuizData();
|
||||||
|
|
||||||
const [ready, setReady] = useState(false);
|
const [ready, setReady] = useState(false);
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
@ -66,7 +75,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
if (email.length > 0) body.email = email;
|
if (email.length > 0) body.email = email;
|
||||||
if (phone.length > 0) body.phone = phone;
|
if (phone.length > 0) body.phone = phone;
|
||||||
if (adress.length > 0) body.address = adress;
|
if (adress.length > 0) body.address = adress;
|
||||||
if (text.length > 0) body.customs = { [FC.text.text || "Фамилия"]: text };
|
if (text.length > 0) body.customs = {[FC.text.text || "Фамилия"]: text};
|
||||||
|
|
||||||
if (Object.keys(body).length > 0) {
|
if (Object.keys(body).length > 0) {
|
||||||
try {
|
try {
|
||||||
@ -79,7 +88,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
const sessions = JSON.parse(localStorage.getItem("sessions") || "{}");
|
const sessions = JSON.parse(localStorage.getItem("sessions") || "{}");
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"sessions",
|
"sessions",
|
||||||
JSON.stringify({ ...sessions, [quizId]: new Date().getTime() })
|
JSON.stringify({...sessions, [quizId]: new Date().getTime()})
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
enqueueSnackbar("ответ не был засчитан");
|
enqueueSnackbar("ответ не был засчитан");
|
||||||
@ -156,7 +165,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
msOverflowStyle: "none",
|
msOverflowStyle: "none",
|
||||||
backgroundPosition: "center",
|
backgroundPosition: "center",
|
||||||
backgroundSize: "cover",
|
backgroundSize: "cover",
|
||||||
backgroundImage: settings.cfg.design
|
backgroundImage: settings.cfg.design && !isMobile
|
||||||
? `url(${DESIGN_LIST[settings.cfg.theme]})`
|
? `url(${DESIGN_LIST[settings.cfg.theme]})`
|
||||||
: null,
|
: null,
|
||||||
}}
|
}}
|
||||||
@ -168,6 +177,11 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
height: "100%",
|
height: "100%",
|
||||||
minHeight: "100vh",
|
minHeight: "100vh",
|
||||||
display: isWide && !isMobile ? "flex" : undefined,
|
display: isWide && !isMobile ? "flex" : undefined,
|
||||||
|
background: settings.cfg.design && !isMobile
|
||||||
|
? quizThemes[settings.cfg.theme].isLight
|
||||||
|
? "transparent"
|
||||||
|
: "linear-gradient(90deg,#272626, transparent)"
|
||||||
|
: theme.palette.background.default,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
@ -179,6 +193,17 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
borderRight: isWide && !isMobile ? "1px solid gray" : undefined,
|
borderRight: isWide && !isMobile ? "1px solid gray" : undefined,
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
maxWidth: "630px",
|
||||||
|
width: "100%",
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "flex-start",
|
||||||
|
justifyContent: "center",
|
||||||
|
padding: isMobile ? "20px 20px 0 20px" : "0 0 0 40px"
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
@ -196,7 +221,6 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
textAlign: "center",
|
|
||||||
m: "20px 0",
|
m: "20px 0",
|
||||||
fontSize: "18px",
|
fontSize: "18px",
|
||||||
wordBreak: "break-word"
|
wordBreak: "break-word"
|
||||||
@ -207,6 +231,8 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
</Box>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@ -214,7 +240,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
backgroundColor: theme.palette.background.default,
|
backgroundColor: theme.palette.background.default,
|
||||||
p: "30px",
|
p: "0px 20px 30px 20px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
@ -266,13 +292,13 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
|||||||
>
|
>
|
||||||
<CustomCheckbox
|
<CustomCheckbox
|
||||||
label=""
|
label=""
|
||||||
handleChange={({ target }) => {
|
handleChange={({target}) => {
|
||||||
setReady(target.checked);
|
setReady(target.checked);
|
||||||
}}
|
}}
|
||||||
checked={ready}
|
checked={ready}
|
||||||
colorIcon={theme.palette.primary.main}
|
colorIcon={theme.palette.primary.main}
|
||||||
/>
|
/>
|
||||||
<Typography sx={{ color: theme.palette.text.primary }}>
|
<Typography sx={{color: theme.palette.text.primary}}>
|
||||||
С 
|
С 
|
||||||
<Link href={"https://shub.pena.digital/ppdd"} target="_blank">
|
<Link href={"https://shub.pena.digital/ppdd"} target="_blank">
|
||||||
Положением об обработке персональных данных{" "}
|
Положением об обработке персональных данных{" "}
|
||||||
@ -336,8 +362,8 @@ const Inputs = ({
|
|||||||
setText,
|
setText,
|
||||||
adress,
|
adress,
|
||||||
setAdress,
|
setAdress,
|
||||||
}: any) => {
|
}: any) => {
|
||||||
const { settings } = useQuizData();
|
const {settings} = useQuizData();
|
||||||
|
|
||||||
const FC = settings.cfg.formContact.fields;
|
const FC = settings.cfg.formContact.fields;
|
||||||
|
|
||||||
@ -345,16 +371,16 @@ const Inputs = ({
|
|||||||
|
|
||||||
const Name = (
|
const Name = (
|
||||||
<CustomInput
|
<CustomInput
|
||||||
onChange={({ target }) => setName(target.value)}
|
onChange={({target}) => setName(target.value)}
|
||||||
id={name}
|
id={name}
|
||||||
title={FC["name"].innerText || "Введите имя"}
|
title={FC["name"].innerText || "Введите имя"}
|
||||||
desc={FC["name"].text || "имя"}
|
desc={FC["name"].text || "Имя"}
|
||||||
Icon={NameIcon}
|
Icon={NameIcon}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
const Email = (
|
const Email = (
|
||||||
<CustomInput
|
<CustomInput
|
||||||
onChange={({ target }) => setEmail(target.value)}
|
onChange={({target}) => setEmail(target.value)}
|
||||||
id={email}
|
id={email}
|
||||||
title={FC["email"].innerText || "Введите Email"}
|
title={FC["email"].innerText || "Введите Email"}
|
||||||
desc={FC["email"].text || "Email"}
|
desc={FC["email"].text || "Email"}
|
||||||
@ -363,28 +389,28 @@ const Inputs = ({
|
|||||||
);
|
);
|
||||||
const Phone = (
|
const Phone = (
|
||||||
<CustomInput
|
<CustomInput
|
||||||
onChange={({ target }) => setPhone(target.value)}
|
onChange={({target}) => setPhone(target.value)}
|
||||||
id={phone}
|
id={phone}
|
||||||
title={FC["phone"].innerText || "Введите номер телефона"}
|
title={FC["phone"].innerText || "Введите номер телефона"}
|
||||||
desc={FC["phone"].text || "номер телефона"}
|
desc={FC["phone"].text || "Номер телефона"}
|
||||||
Icon={PhoneIcon}
|
Icon={PhoneIcon}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
const Text = (
|
const Text = (
|
||||||
<CustomInput
|
<CustomInput
|
||||||
onChange={({ target }) => setText(target.value)}
|
onChange={({target}) => setText(target.value)}
|
||||||
id={text}
|
id={text}
|
||||||
title={FC["text"].text || "Введите фамилию"}
|
title={FC["text"].text || "Введите фамилию"}
|
||||||
desc={FC["text"].innerText || "фамилию"}
|
desc={FC["text"].innerText || "Фамилия"}
|
||||||
Icon={TextIcon}
|
Icon={TextIcon}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
const Adress = (
|
const Adress = (
|
||||||
<CustomInput
|
<CustomInput
|
||||||
onChange={({ target }) => setAdress(target.value)}
|
onChange={({target}) => setAdress(target.value)}
|
||||||
id={adress}
|
id={adress}
|
||||||
title={FC["address"].innerText || "Введите адрес"}
|
title={FC["address"].innerText || "Введите адрес"}
|
||||||
desc={FC["address"].text || "адрес"}
|
desc={FC["address"].text || "Адрес"}
|
||||||
Icon={AddressIcon}
|
Icon={AddressIcon}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -410,16 +436,16 @@ const Inputs = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const CustomInput = ({ title, desc, Icon, onChange, id }: {
|
const CustomInput = ({title, desc, Icon, onChange, id}: {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
desc: string;
|
desc: string;
|
||||||
Icon: FC<{ color: string; }>;
|
Icon: FC<{ color: string; backgroundColor: string }>;
|
||||||
onChange: TextFieldProps["onChange"];
|
onChange: TextFieldProps["onChange"];
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useRootContainerSize() < 600;
|
const isMobile = useRootContainerSize() < 600;
|
||||||
|
const {settings} = useQuizData();
|
||||||
return (
|
return (
|
||||||
<Box m="15px 0">
|
<Box m="15px 0">
|
||||||
<Typography mb="7px" color={theme.palette.text.primary}>
|
<Typography mb="7px" color={theme.palette.text.primary}>
|
||||||
@ -430,15 +456,22 @@ const CustomInput = ({ title, desc, Icon, onChange, id }: {
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
sx={{
|
sx={{
|
||||||
width: isMobile ? "300px" : "350px",
|
width: isMobile ? "300px" : "350px",
|
||||||
|
backgroundColor: theme.palette.background.default,
|
||||||
"& .MuiOutlinedInput-notchedOutline": {
|
"& .MuiOutlinedInput-notchedOutline": {
|
||||||
borderColor: "#9A9AAF"
|
borderColor: "#9A9AAF80",
|
||||||
|
borderRadius: "12px"
|
||||||
|
},
|
||||||
|
"& .MuiInputBase-root": {
|
||||||
|
paddingLeft: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
placeholder={desc}
|
placeholder={desc}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
startAdornment: (
|
startAdornment: (
|
||||||
<InputAdornment position="start">
|
<InputAdornment position="start">
|
||||||
<Icon color="gray" />
|
<Icon color="gray"
|
||||||
|
backgroundColor={quizThemes[settings.cfg.theme].isLight ? "#F2F3F7" : "#F2F3F71A"}/>
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -5,25 +5,25 @@ import {
|
|||||||
useTheme
|
useTheme
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
|
|
||||||
import { NameplateLogo } from "@icons/NameplateLogo";
|
import {NameplateLogo} from "@icons/NameplateLogo";
|
||||||
import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe";
|
import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe";
|
||||||
|
|
||||||
import { useQuizData } from "@contexts/QuizDataContext";
|
import {useQuizData} from "@contexts/QuizDataContext";
|
||||||
import { quizThemes } from "@utils/themes/Publication/themePublication";
|
import {quizThemes} from "@utils/themes/Publication/themePublication";
|
||||||
import { useRootContainerSize } from "../../contexts/RootContainerWidthContext";
|
import {useRootContainerSize} from "../../contexts/RootContainerWidthContext";
|
||||||
import type { QuizQuestionResult } from "../../model/questionTypes/result";
|
import type {QuizQuestionResult} from "../../model/questionTypes/result";
|
||||||
import { setCurrentQuizStep } from "@stores/quizView";
|
import {setCurrentQuizStep} from "@stores/quizView";
|
||||||
import { DESIGN_LIST } from "@/components/ViewPublicationPage/Question";
|
import {DESIGN_LIST} from "@/components/ViewPublicationPage/Question";
|
||||||
|
|
||||||
type ResultFormProps = {
|
type ResultFormProps = {
|
||||||
resultQuestion: QuizQuestionResult;
|
resultQuestion: QuizQuestionResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
export const ResultForm = ({resultQuestion}: ResultFormProps) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useRootContainerSize() < 650;
|
const isMobile = useRootContainerSize() < 650;
|
||||||
const isTablet = useRootContainerSize() < 1000;
|
const isTablet = useRootContainerSize() < 1000;
|
||||||
const { settings, show_badge } = useQuizData();
|
const {settings, show_badge} = useQuizData();
|
||||||
const spec = settings.cfg.spec
|
const spec = settings.cfg.spec
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -36,26 +36,41 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
height: "100%",
|
height: "100%",
|
||||||
minHeight: "100vh",
|
minHeight: "100vh",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
pt: "28px",
|
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
backgroundColor: theme.palette.background.default,
|
backgroundColor: theme.palette.background.default,
|
||||||
backgroundPosition: "center",
|
backgroundPosition: "center",
|
||||||
backgroundSize: "cover",
|
backgroundSize: "cover",
|
||||||
backgroundImage: settings.cfg.design
|
backgroundImage: settings.cfg.design && !isMobile
|
||||||
? `url(${DESIGN_LIST[settings.cfg.theme]})`
|
? `url(${DESIGN_LIST[settings.cfg.theme]})`
|
||||||
: null,
|
: null,
|
||||||
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
alignItems: "start",
|
justifyContent: "space-between",
|
||||||
maxWidth: "844px",
|
alignItems: "center",
|
||||||
width: "100%",
|
pt: "30px",
|
||||||
padding: isMobile ? "0 16px" : isTablet ? "0 78px" : undefined,
|
width: "inherit",
|
||||||
|
height: "inherit",
|
||||||
|
background: settings.cfg.design
|
||||||
|
? quizThemes[settings.cfg.theme].isLight
|
||||||
|
? "transparent"
|
||||||
|
: "linear-gradient(90deg,#272626, transparent)"
|
||||||
|
: theme.palette.background.default,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "flex-start",
|
||||||
|
width: "100%",
|
||||||
|
maxWidth: "844px",
|
||||||
|
padding: isMobile ? "0 16px" : isTablet ? "0 78px" : undefined,
|
||||||
|
}}>
|
||||||
{
|
{
|
||||||
!resultQuestion?.content.useImage && resultQuestion.content.video && (
|
!resultQuestion?.content.useImage && resultQuestion.content.video && (
|
||||||
<YoutubeEmbedIframe
|
<YoutubeEmbedIframe
|
||||||
@ -125,6 +140,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
}
|
}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|
||||||
<Box width="100%">
|
<Box width="100%">
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -170,12 +186,13 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
boxShadow: "0 0 15px 0 rgba(0,0,0,.08)",
|
// boxShadow: "0 0 15px 0 rgba(0,0,0,.08)",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
border: "1px solid #9A9AAF80",
|
||||||
p:
|
p:
|
||||||
(
|
(
|
||||||
settings.cfg.resultInfo.showResultForm === "before" &&
|
settings.cfg.resultInfo.showResultForm === "before" &&
|
||||||
@ -206,7 +223,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
<Button
|
<Button
|
||||||
href={resultQuestion.content.redirect}
|
href={resultQuestion.content.redirect}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
sx={{ p: "10px 20px", width: "auto", height: "50px" }}
|
sx={{p: "10px 20px", width: "auto", height: "50px"}}
|
||||||
>
|
>
|
||||||
{resultQuestion.content.hint.text || "Перейти на сайт"}
|
{resultQuestion.content.hint.text || "Перейти на сайт"}
|
||||||
</Button>
|
</Button>
|
||||||
@ -214,5 +231,6 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -64,7 +64,7 @@ export default function ViewPublicationPage() {
|
|||||||
sx={{
|
sx={{
|
||||||
fontSize: "16px",
|
fontSize: "16px",
|
||||||
padding: "10px 15px",
|
padding: "10px 15px",
|
||||||
color: "#FFFFFF",
|
color: "#9A9AAF",
|
||||||
border: "1px solid #9A9AAF",
|
border: "1px solid #9A9AAF",
|
||||||
background: "rgba(154,154,175, 0.2)",
|
background: "rgba(154,154,175, 0.2)",
|
||||||
"&:disabled": {
|
"&:disabled": {
|
||||||
|
|||||||
@ -88,6 +88,9 @@ export const Select = ({
|
|||||||
height: "48px",
|
height: "48px",
|
||||||
borderRadius: "10px",
|
borderRadius: "10px",
|
||||||
},
|
},
|
||||||
|
"& .MuiSelect-icon": {
|
||||||
|
color: theme.palette.primary.main
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
MenuProps={{
|
MenuProps={{
|
||||||
PaperProps: {
|
PaperProps: {
|
||||||
@ -106,7 +109,7 @@ export const Select = ({
|
|||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
gap: "8px",
|
gap: "8px",
|
||||||
"& .Mui-selected": {
|
"& .Mui-selected": {
|
||||||
backgroundColor: theme.palette.background.default,
|
backgroundColor: "#F2F3F7",
|
||||||
color: colorMain,
|
color: colorMain,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -114,7 +117,7 @@ export const Select = ({
|
|||||||
}}
|
}}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
sx: {
|
sx: {
|
||||||
color: colorMain,
|
color: theme.palette.text.primary,
|
||||||
display: "block",
|
display: "block",
|
||||||
px: "9px",
|
px: "9px",
|
||||||
gap: "20px",
|
gap: "20px",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@frontend/squzanswerer",
|
"name": "@frontend/squzanswerer",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist-package/index.js",
|
"main": "./dist-package/index.js",
|
||||||
"module": "./dist-package/index.js",
|
"module": "./dist-package/index.js",
|
||||||
@ -86,6 +86,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"country-flag-emoji-polyfill": "^0.1.8",
|
"country-flag-emoji-polyfill": "^0.1.8",
|
||||||
"hex-rgb": "^5.0.0"
|
"current-device": "^0.10.2",
|
||||||
|
"hex-rgb": "^5.0.0",
|
||||||
|
"mobile-detect": "^1.4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
yarn.lock
10
yarn.lock
@ -1593,6 +1593,11 @@ csstype@^3.0.2, csstype@^3.1.2:
|
|||||||
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
|
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
|
||||||
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
|
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
|
||||||
|
|
||||||
|
current-device@^0.10.2:
|
||||||
|
version "0.10.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/current-device/-/current-device-0.10.2.tgz#1e40176bee7da655383ab7245b853fae7d2dfc8e"
|
||||||
|
integrity sha512-FN223n2Cp1fRI/gyjJEAdagHhJ/2Z2STz3tUg1t4F259BhmVRCChkmxcgFtjYJsWuIacQEs7bqJpnAczIXIkWw==
|
||||||
|
|
||||||
cypress@^13.6.1:
|
cypress@^13.6.1:
|
||||||
version "13.6.3"
|
version "13.6.3"
|
||||||
resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.6.3.tgz#54f03ca07ee56b2bc18211e7bd32abd2533982ba"
|
resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.6.3.tgz#54f03ca07ee56b2bc18211e7bd32abd2533982ba"
|
||||||
@ -2687,6 +2692,11 @@ minimist@^1.2.8:
|
|||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
|
||||||
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
||||||
|
|
||||||
|
mobile-detect@^1.4.5:
|
||||||
|
version "1.4.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/mobile-detect/-/mobile-detect-1.4.5.tgz#da393c3c413ca1a9bcdd9ced653c38281c0fb6ad"
|
||||||
|
integrity sha512-yc0LhH6tItlvfLBugVUEtgawwFU2sIe+cSdmRJJCTMZ5GEJyLxNyC/NIOAOGk67Fa8GNpOttO3Xz/1bHpXFD/g==
|
||||||
|
|
||||||
moment@^2.30.1:
|
moment@^2.30.1:
|
||||||
version "2.30.1"
|
version "2.30.1"
|
||||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
|
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user