2024-01-10 18:02:37 +00:00
|
|
|
|
import {
|
2024-01-30 16:49:33 +00:00
|
|
|
|
Box,
|
2024-02-11 19:48:59 +00:00
|
|
|
|
Button, Link,
|
2024-01-30 16:49:33 +00:00
|
|
|
|
Typography,
|
2024-02-05 10:10:02 +00:00
|
|
|
|
useTheme
|
2024-01-10 18:02:37 +00:00
|
|
|
|
} from "@mui/material";
|
2023-12-16 14:55:56 +00:00
|
|
|
|
|
2023-12-21 19:22:06 +00:00
|
|
|
|
import { NameplateLogo } from "@icons/NameplateLogo";
|
2024-01-30 16:49:33 +00:00
|
|
|
|
import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe";
|
2023-12-16 14:55:56 +00:00
|
|
|
|
|
2024-02-08 13:42:31 +00:00
|
|
|
|
import { setCurrentQuizStep } from "@stores/quizView/store";
|
2024-02-05 10:10:02 +00:00
|
|
|
|
import { useQuizData } from "@utils/hooks/useQuizData";
|
2024-01-30 16:49:33 +00:00
|
|
|
|
import { quizThemes } from "@utils/themes/Publication/themePublication";
|
2024-02-05 10:10:02 +00:00
|
|
|
|
import { useRootContainerSize } from "../../contexts/RootContainerWidthContext";
|
2024-01-10 18:02:37 +00:00
|
|
|
|
import type { QuizQuestionResult } from "../../model/questionTypes/result";
|
|
|
|
|
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
2023-12-16 14:55:56 +00:00
|
|
|
|
type ResultFormProps = {
|
2024-02-08 13:42:31 +00:00
|
|
|
|
resultQuestion: QuizQuestionResult;
|
2023-12-16 14:55:56 +00:00
|
|
|
|
};
|
2024-02-08 13:42:31 +00:00
|
|
|
|
|
|
|
|
|
export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
2024-01-30 16:49:33 +00:00
|
|
|
|
const theme = useTheme();
|
2024-02-05 10:10:02 +00:00
|
|
|
|
const isMobile = useRootContainerSize() < 650;
|
2024-02-08 13:42:31 +00:00
|
|
|
|
const { settings } = useQuizData();
|
2023-12-16 14:55:56 +00:00
|
|
|
|
|
2023-12-17 13:22:21 +00:00
|
|
|
|
return (
|
|
|
|
|
<Box
|
2024-01-30 16:49:33 +00:00
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: "space-between",
|
2024-02-08 13:42:31 +00:00
|
|
|
|
height: "100%",
|
2024-01-30 16:49:33 +00:00
|
|
|
|
width: "100vw",
|
|
|
|
|
pt: "28px",
|
|
|
|
|
overflow: "auto",
|
|
|
|
|
}}
|
2023-12-17 13:22:21 +00:00
|
|
|
|
>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
<Box
|
2023-12-29 00:58:19 +00:00
|
|
|
|
sx={{
|
2024-01-30 16:49:33 +00:00
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
alignItems: "start",
|
|
|
|
|
width: isMobile ? "100%" : "490px",
|
|
|
|
|
padding: isMobile ? "0 16px" : undefined,
|
2023-12-29 00:58:19 +00:00
|
|
|
|
}}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
!resultQuestion?.content.useImage && resultQuestion.content.video && (
|
|
|
|
|
<YoutubeEmbedIframe
|
|
|
|
|
videoUrl={resultQuestion.content.video}
|
|
|
|
|
containerSX={{
|
|
|
|
|
width: isMobile ? "100%" : "490px",
|
|
|
|
|
height: isMobile ? "100%" : "280px",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
resultQuestion?.content.useImage && resultQuestion.content.back && (
|
|
|
|
|
<Box
|
|
|
|
|
component="img"
|
|
|
|
|
src={resultQuestion.content.back}
|
|
|
|
|
sx={{
|
|
|
|
|
width: isMobile ? "100%" : "490px",
|
|
|
|
|
height: isMobile ? "100%" : "280px",
|
|
|
|
|
}}
|
|
|
|
|
></Box>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
{resultQuestion.description !== "" &&
|
|
|
|
|
resultQuestion.description !== " " && (
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontSize: "23px",
|
|
|
|
|
fontWeight: 700,
|
|
|
|
|
m: "20px 0",
|
|
|
|
|
color: theme.palette.text.primary,
|
2024-02-11 15:35:45 +00:00
|
|
|
|
wordBreak: "break-word"
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{resultQuestion.description}
|
|
|
|
|
</Typography>
|
|
|
|
|
)}
|
2023-12-17 13:22:21 +00:00
|
|
|
|
|
2024-01-10 18:02:37 +00:00
|
|
|
|
<Typography
|
2024-01-30 16:49:33 +00:00
|
|
|
|
sx={{
|
|
|
|
|
m: "20px 0",
|
|
|
|
|
color: theme.palette.text.primary,
|
2024-02-11 15:35:45 +00:00
|
|
|
|
wordBreak: "break-word"
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
2024-01-10 18:02:37 +00:00
|
|
|
|
>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
{resultQuestion.title}
|
2024-01-10 18:02:37 +00:00
|
|
|
|
</Typography>
|
2023-12-17 13:22:21 +00:00
|
|
|
|
|
2024-01-30 16:49:33 +00:00
|
|
|
|
{
|
|
|
|
|
resultQuestion.content.text !== "" &&
|
|
|
|
|
resultQuestion.content.text !== " " && (
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontSize: "18px",
|
|
|
|
|
m: "20px 0",
|
2024-02-11 15:35:45 +00:00
|
|
|
|
wordBreak: "break-word",
|
2024-01-30 16:49:33 +00:00
|
|
|
|
color: theme.palette.text.primary,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
resultQuestion.content.text
|
|
|
|
|
}
|
|
|
|
|
</Typography>
|
|
|
|
|
)
|
|
|
|
|
}
|
2023-12-21 19:22:06 +00:00
|
|
|
|
</Box>
|
|
|
|
|
|
2024-01-30 16:49:33 +00:00
|
|
|
|
<Box width="100%">
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
width: "100%",
|
|
|
|
|
justifyContent: "end",
|
|
|
|
|
px: "20px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
2024-02-11 19:48:59 +00:00
|
|
|
|
component={Link}
|
|
|
|
|
target={"_blank"}
|
|
|
|
|
href={"https://quiz.pena.digital"}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
mt: "15px",
|
|
|
|
|
gap: "10px",
|
2024-02-11 19:48:59 +00:00
|
|
|
|
textDecoration: "none",
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<NameplateLogo
|
|
|
|
|
style={{
|
|
|
|
|
fontSize: "34px",
|
|
|
|
|
color: quizThemes[settings.cfg.theme].isLight ? "#000000" : "#F5F7FF",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontSize: "20px",
|
|
|
|
|
color: quizThemes[settings.cfg.theme].isLight ? "#4D4D4D" : "#F5F7FF",
|
|
|
|
|
whiteSpace: "nowrap",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Сделано на PenaQuiz
|
|
|
|
|
</Typography>
|
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
|
2024-02-12 00:54:12 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
boxShadow: "0 0 15px 0 rgba(0,0,0,.08)",
|
|
|
|
|
width: "100%",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
display: "flex",
|
|
|
|
|
justifyContent: "center",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
p: settings.cfg.resultInfo.showResultForm === "before" ||
|
|
|
|
|
(
|
|
|
|
|
settings.cfg.resultInfo.showResultForm === "after" &&
|
|
|
|
|
resultQuestion.content.redirect
|
|
|
|
|
) ? "20px" : "0",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{settings.cfg.resultInfo.showResultForm === "before" && (
|
2024-01-30 16:49:33 +00:00
|
|
|
|
<Button
|
2024-02-12 00:54:12 +00:00
|
|
|
|
onClick={() => setCurrentQuizStep("contactform")}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
variant="contained"
|
2024-02-12 00:54:12 +00:00
|
|
|
|
sx={{
|
|
|
|
|
p: "10px 20px",
|
|
|
|
|
width: "auto",
|
|
|
|
|
height: "50px",
|
|
|
|
|
}}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
>
|
2024-02-12 00:54:12 +00:00
|
|
|
|
{resultQuestion.content.hint.text || "Узнать подробнее"}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
</Button>
|
|
|
|
|
)}
|
2024-02-12 00:54:12 +00:00
|
|
|
|
{settings.cfg.resultInfo.showResultForm === "after" &&
|
|
|
|
|
resultQuestion.content.redirect && (
|
|
|
|
|
<Button
|
|
|
|
|
href={resultQuestion.content.redirect}
|
|
|
|
|
variant="contained"
|
|
|
|
|
sx={{ p: "10px 20px", width: "auto", height: "50px" }}
|
|
|
|
|
>
|
|
|
|
|
{resultQuestion.content.hint.text || "Перейти на сайт"}
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
</Box>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
</Box>
|
2023-12-21 19:22:06 +00:00
|
|
|
|
</Box>
|
2023-12-17 13:22:21 +00:00
|
|
|
|
);
|
2024-01-10 18:02:37 +00:00
|
|
|
|
};
|