форма контактов
This commit is contained in:
parent
9ce829f98f
commit
36c7b44ee8
@ -27,7 +27,7 @@ const buttons = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Email",
|
name: "Email",
|
||||||
desc: "mail@xample.ru",
|
desc: "mail@example.ru",
|
||||||
key: "email"
|
key: "email"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -297,7 +297,7 @@ const ButtonsCard = ({ drawerNewFieldHC }: any) => {
|
|||||||
Добавить поле +
|
Добавить поле +
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
<Link
|
{/* <Link
|
||||||
component="button"
|
component="button"
|
||||||
// onClick={() => drawerMessengerHC(true)}
|
// onClick={() => drawerMessengerHC(true)}
|
||||||
sx={{
|
sx={{
|
||||||
@ -309,7 +309,7 @@ const ButtonsCard = ({ drawerNewFieldHC }: any) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Добавить мессенджеры
|
Добавить мессенджеры
|
||||||
</Link>
|
</Link> */}
|
||||||
|
|
||||||
<PseudoButton />
|
<PseudoButton />
|
||||||
</Box>
|
</Box>
|
||||||
@ -355,7 +355,7 @@ const EmptyCard = ({ drawerNewFieldHC }: { drawerNewFieldHC: (a: string) => void
|
|||||||
|
|
||||||
</Popover>
|
</Popover>
|
||||||
</Box>
|
</Box>
|
||||||
<Link
|
{/* <Link
|
||||||
sx={{
|
sx={{
|
||||||
mt: "20px",
|
mt: "20px",
|
||||||
fontSize: "16px",
|
fontSize: "16px",
|
||||||
@ -365,7 +365,7 @@ const EmptyCard = ({ drawerNewFieldHC }: { drawerNewFieldHC: (a: string) => void
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Добавить мессенджеры
|
Добавить мессенджеры
|
||||||
</Link>
|
</Link> */}
|
||||||
<PseudoButton />
|
<PseudoButton />
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -458,7 +458,7 @@ export const ResultCard = ({ resultContract, resultData }: Props) => {
|
|||||||
placeholder="URL видео"
|
placeholder="URL видео"
|
||||||
text={resultData.content.video ?? ""}
|
text={resultData.content.video ?? ""}
|
||||||
onChange={e => updateQuestion(resultData.id, q => {
|
onChange={e => updateQuestion(resultData.id, q => {
|
||||||
resultData.content.video = e.target.value;
|
q.content.video = e.target.value;
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@ -1,6 +1,13 @@
|
|||||||
import { Box, Typography, Button } from "@mui/material";
|
import { Box, Typography, Button, Paper, TextField, Link, FormControl } from "@mui/material";
|
||||||
|
import NameIcon from "@icons/ContactFormIcon/NameIcon";
|
||||||
|
import EmailIcon from "@icons/ContactFormIcon/EmailIcon";
|
||||||
|
import PhoneIcon from "@icons/ContactFormIcon/PhoneIcon";
|
||||||
|
import TextIcon from "@icons/ContactFormIcon/TextIcon";
|
||||||
|
import AddressIcon from "@icons/ContactFormIcon/AddressIcon";
|
||||||
|
|
||||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||||
|
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
type ContactFormProps = {
|
type ContactFormProps = {
|
||||||
showResultForm: boolean;
|
showResultForm: boolean;
|
||||||
@ -8,6 +15,14 @@ type ContactFormProps = {
|
|||||||
setShowResultForm: (show: boolean) => void;
|
setShowResultForm: (show: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const icons = [
|
||||||
|
{ type: "name", icon: NameIcon, defaultText: "Введите имя", defaultTitle: "имя" },
|
||||||
|
{ type: "email", icon: EmailIcon, defaultText: "Введите Email", defaultTitle: "Email" },
|
||||||
|
{ type: "phone", icon: PhoneIcon, defaultText: "Введите номер телефона", defaultTitle: "номер телефона" },
|
||||||
|
{ type: "text", icon: TextIcon, defaultText: "Введите фамилию", defaultTitle: "фамилию" },
|
||||||
|
{ type: "address", icon: AddressIcon, defaultText: "Введите адрес", defaultTitle: "адрес" },
|
||||||
|
]
|
||||||
|
|
||||||
export const ContactForm = ({
|
export const ContactForm = ({
|
||||||
showResultForm,
|
showResultForm,
|
||||||
setShowContactForm,
|
setShowContactForm,
|
||||||
@ -15,19 +30,109 @@ export const ContactForm = ({
|
|||||||
}: ContactFormProps) => {
|
}: ContactFormProps) => {
|
||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
|
|
||||||
|
const [ready, setReady] = useState(false)
|
||||||
const followNextForm = () => {
|
const followNextForm = () => {
|
||||||
setShowContactForm(false);
|
setShowContactForm(false);
|
||||||
setShowResultForm(true);
|
setShowResultForm(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box
|
||||||
<Typography>Форма контактов</Typography>
|
sx={{
|
||||||
{!showResultForm && quiz?.config.resultInfo.when === "after" && (
|
display: "flex",
|
||||||
<Button variant="contained" onClick={followNextForm}>
|
alignItems: "center",
|
||||||
Показать результат
|
justifyContent: "center",
|
||||||
</Button>
|
height: "100vh"
|
||||||
)}
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
width: "800px"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
|
||||||
|
<Box>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
textAlign: "center",
|
||||||
|
m: "20px 0",
|
||||||
|
fontSize: "28px"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Заполните форму, чтобы получить результаты теста
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
|
||||||
|
<Paper
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
flexDirection: "column",
|
||||||
|
p: "30px"
|
||||||
|
}}>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
my: "20px"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
icons.map((data) => {
|
||||||
|
const FC = quiz?.config.formContact[data.type]
|
||||||
|
return FC.used ? <CustomInput title={FC.innerText || data.defaultText} desc={FC.text || data.defaultTitle} Icon={data.icon} />
|
||||||
|
:
|
||||||
|
<></>
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
{!showResultForm && quiz?.config.resultInfo.when === "after" && (
|
||||||
|
<Button
|
||||||
|
disabled={!ready}
|
||||||
|
variant="contained" onClick={followNextForm}>
|
||||||
|
Получить результаты
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
mt: "20px",
|
||||||
|
width: "450px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CustomCheckbox label="" handleChange={({target}) => {setReady(target.checked)}} checked={ready} />
|
||||||
|
<Typography>
|
||||||
|
С
|
||||||
|
<Link> Положением об обработке персональных данных </Link>
|
||||||
|
и
|
||||||
|
<Link> Политикой конфиденциальности </Link>
|
||||||
|
ознакомлен
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CustomInput = ({ title, desc, Icon }: any) => {
|
||||||
|
return <Box m="15px 0">
|
||||||
|
<Typography mb="7px">{title}</Typography>
|
||||||
|
<TextField
|
||||||
|
sx={{
|
||||||
|
width: "350px",
|
||||||
|
}}
|
||||||
|
placeholder={desc}
|
||||||
|
InputProps={{
|
||||||
|
startAdornment: <Icon color="gray" />,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
}
|
||||||
@ -68,17 +68,20 @@ export const Question = ({ questions }: QuestionProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Box
|
<Box>
|
||||||
sx={{
|
|
||||||
minHeight: "calc(100vh - 75px)",
|
|
||||||
width: "100%",
|
|
||||||
maxWidth: "1440px",
|
|
||||||
padding: "40px 25px 20px",
|
|
||||||
margin: "0 auto",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{!showContactForm && !showResultForm && !resultQuestion && (
|
{!showContactForm && !showResultForm && !resultQuestion && (
|
||||||
<QuestionComponent currentQuestion={currentQuestion} />
|
<Box
|
||||||
|
sx={{
|
||||||
|
minHeight: "calc(100vh - 75px)",
|
||||||
|
width: "100%",
|
||||||
|
maxWidth: "1440px",
|
||||||
|
margin: "0 auto",
|
||||||
|
padding: "40px 25px 20px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
|
||||||
|
<QuestionComponent currentQuestion={currentQuestion} />
|
||||||
|
</Box>
|
||||||
)}
|
)}
|
||||||
{resultQuestion && (
|
{resultQuestion && (
|
||||||
<ResultQuestion
|
<ResultQuestion
|
||||||
@ -97,6 +100,7 @@ export const Question = ({ questions }: QuestionProps) => {
|
|||||||
)}
|
)}
|
||||||
{showResultForm && (
|
{showResultForm && (
|
||||||
<ResultForm
|
<ResultForm
|
||||||
|
resultQuestion={resultQuestion}
|
||||||
showContactForm={showContactForm}
|
showContactForm={showContactForm}
|
||||||
setShowContactForm={setShowContactForm}
|
setShowContactForm={setShowContactForm}
|
||||||
setShowResultForm={setShowResultForm}
|
setShowResultForm={setShowResultForm}
|
||||||
|
|||||||
@ -1,28 +1,121 @@
|
|||||||
import { Box, Typography, Button } from "@mui/material";
|
import { Box, Typography, Button } from "@mui/material";
|
||||||
|
import { getQuestionByContentId } from "@root/questions/actions";
|
||||||
|
|
||||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||||
|
import { useQuestionsStore } from "@root/questions/store";
|
||||||
|
import YoutubeEmbedIframe from "../../ui_kit/StartPagePreview/YoutubeEmbedIframe.tsx"
|
||||||
|
|
||||||
type ResultFormProps = {
|
type ResultFormProps = {
|
||||||
|
resultQuestion: string;
|
||||||
showContactForm: boolean;
|
showContactForm: boolean;
|
||||||
setShowContactForm: (show: boolean) => void;
|
setShowContactForm: (show: boolean) => void;
|
||||||
setShowResultForm: (show: boolean) => void;
|
setShowResultForm: (show: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ResultForm = ({
|
export const ResultForm = ({
|
||||||
|
resultQuestion,
|
||||||
showContactForm,
|
showContactForm,
|
||||||
setShowContactForm,
|
setShowContactForm,
|
||||||
setShowResultForm,
|
setShowResultForm,
|
||||||
|
|
||||||
}: ResultFormProps) => {
|
}: ResultFormProps) => {
|
||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
|
const myresult = useQuestionsStore().questions.filter((q) => q.type === "result")[0]
|
||||||
|
console.log("ResultForm")
|
||||||
|
console.log(myresult)
|
||||||
|
|
||||||
const followNextForm = () => {
|
const followNextForm = () => {
|
||||||
setShowResultForm(false);
|
setShowResultForm(false);
|
||||||
setShowContactForm(true);
|
setShowContactForm(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log("quiz", quiz)
|
||||||
|
console.log("quiz?.config.useImage", myresult?.content.useImage)
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box
|
||||||
<Typography>Форма результатов</Typography>
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
height: "100vh",
|
||||||
|
width: "100vw",
|
||||||
|
pt: "28px"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "start",
|
||||||
|
width: "490px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
!myresult?.content.useImage &&
|
||||||
|
myresult.content.video &&
|
||||||
|
<YoutubeEmbedIframe
|
||||||
|
videoUrl={myresult.content.video}
|
||||||
|
containerSX={{
|
||||||
|
width: "490px",
|
||||||
|
height: "280px"
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
myresult?.content.useImage &&
|
||||||
|
myresult.content.back &&
|
||||||
|
<Box
|
||||||
|
component='img'
|
||||||
|
src={myresult.content.back}
|
||||||
|
sx={{
|
||||||
|
width: "490px",
|
||||||
|
height: "280px"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
</Box>
|
||||||
|
}
|
||||||
|
|
||||||
|
{myresult.description !== "" && myresult.description !== " " && <Typography
|
||||||
|
sx={{
|
||||||
|
fontSize: "23px",
|
||||||
|
fontWeight: 700,
|
||||||
|
m: "20px 0"
|
||||||
|
}}
|
||||||
|
>{myresult.description}</Typography>}
|
||||||
|
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
m: "20px 0"
|
||||||
|
}}
|
||||||
|
>{myresult.title || "Форма результатов"}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
height: "100px",
|
||||||
|
boxShadow: "0 0 15px 0 rgba(0,0,0,.08)",
|
||||||
|
width: "100%",
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
sx={{
|
||||||
|
p:"10px 20px",
|
||||||
|
width: "210px",
|
||||||
|
height: "50px"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{myresult.content.hint.text || "Узнать подробнее"}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{!showContactForm && quiz?.config.resultInfo.when !== "after" && (
|
{!showContactForm && quiz?.config.resultInfo.when !== "after" && (
|
||||||
<Button variant="contained" onClick={followNextForm}>
|
<Button variant="contained" onClick={followNextForm}>
|
||||||
Показать форму контактов
|
Показать форму контактов
|
||||||
|
|||||||
@ -11,13 +11,14 @@ type ResultQuestionProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ResultQuestion = ({
|
export const ResultQuestion = ({
|
||||||
resultQuestion,
|
|
||||||
setResultQuestion,
|
setResultQuestion,
|
||||||
setShowContactForm,
|
setShowContactForm,
|
||||||
setShowResultForm,
|
setShowResultForm,
|
||||||
}: ResultQuestionProps) => {
|
}: ResultQuestionProps) => {
|
||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
const { questions } = useQuestionsStore();
|
const { questions } = useQuestionsStore();
|
||||||
|
console.log("ResultQuestion")
|
||||||
|
console.log(resultQuestion)
|
||||||
|
|
||||||
const followNextForm = () => {
|
const followNextForm = () => {
|
||||||
setResultQuestion("");
|
setResultQuestion("");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user