result page refactoring completed
This commit is contained in:
parent
9fbd5b8eec
commit
afb641c382
@ -18,33 +18,33 @@ type ResultFormProps = {
|
|||||||
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() < 1100;
|
||||||
const {settings, show_badge, quizId} = useQuizData();
|
const {settings, show_badge, quizId} = useQuizData();
|
||||||
const setCurrentQuizStep = useQuizViewStore(
|
const setCurrentQuizStep = useQuizViewStore(
|
||||||
(state) => state.setCurrentQuizStep
|
(state) => state.setCurrentQuizStep,
|
||||||
);
|
);
|
||||||
const spec = settings.cfg.spec;
|
const spec = settings.cfg.spec;
|
||||||
|
|
||||||
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-result-{${resultQuestion.id}}`
|
`penaquiz-result-{${resultQuestion.id}}`,
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
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-result-{${resultQuestion.id}}`
|
goal: `penaquiz-result-{${resultQuestion.id}}`,
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
}, [])
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -63,6 +63,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
settings.cfg.design && !isMobile
|
settings.cfg.design && !isMobile
|
||||||
? `url(${DESIGN_LIST[settings.cfg.theme]})`
|
? `url(${DESIGN_LIST[settings.cfg.theme]})`
|
||||||
: null,
|
: null,
|
||||||
|
position: "relative",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
@ -71,16 +72,25 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
pt: "30px",
|
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: "100%",
|
height: "100%",
|
||||||
overflow: "auto",
|
|
||||||
background:
|
background:
|
||||||
settings.cfg.design && !isMobile
|
settings.cfg.design && !isMobile
|
||||||
? quizThemes[settings.cfg.theme].isLight
|
? quizThemes[settings.cfg.theme].isLight
|
||||||
? "transparent"
|
? "transparent"
|
||||||
: "linear-gradient(90deg,#272626, transparent)"
|
: "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%)"
|
||||||
: theme.palette.background.default,
|
: theme.palette.background.default,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
overflow: "auto",
|
||||||
|
padding: "0 20px 20px",
|
||||||
scrollbarWidth: "none",
|
scrollbarWidth: "none",
|
||||||
"&::-webkit-scrollbar": {
|
"&::-webkit-scrollbar": {
|
||||||
width: 0,
|
width: 0,
|
||||||
@ -92,14 +102,18 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
flexWrap: "wrap",
|
flexWrap: "wrap",
|
||||||
gap: "30px",
|
mb: "10px",
|
||||||
mb: "7px",
|
width: "100%",
|
||||||
|
maxWidth: "700px",
|
||||||
|
backgroundColor: "#9A9AAF1A",
|
||||||
|
borderRadius: "0 0 12px 12px",
|
||||||
|
padding: "20px 20px 15px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: "14px",
|
fontSize: "17px",
|
||||||
color: theme.palette.text.primary,
|
color: "#9A9AAF",
|
||||||
wordBreak: "break-word",
|
wordBreak: "break-word",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -112,8 +126,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
alignItems: "flex-start",
|
alignItems: "flex-start",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
maxWidth: "844px",
|
maxWidth: "700px",
|
||||||
padding: isMobile ? "0 16px" : isTablet ? "0 78px" : undefined,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!resultQuestion?.content.useImage &&
|
{!resultQuestion?.content.useImage &&
|
||||||
@ -122,24 +135,29 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
videoUrl={resultQuestion.content.video}
|
videoUrl={resultQuestion.content.video}
|
||||||
containerSX={{
|
containerSX={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
maxWidth: "844px",
|
maxWidth: "700px",
|
||||||
height: isMobile ? "100%" : "306px",
|
height: isMobile ? "100%" : "306px",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{resultQuestion?.content.useImage && resultQuestion.content.back && (
|
{resultQuestion?.content.useImage &&
|
||||||
|
resultQuestion.content.back && (
|
||||||
<Box
|
<Box
|
||||||
sx={{ width: "100%", display: "flex", justifyContent: "center" }}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
component="img"
|
|
||||||
src={resultQuestion.content.back}
|
|
||||||
sx={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
maxWidth: "306px",
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="resultImage"
|
||||||
|
src={resultQuestion.content.back}
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
height: spec ? "auto" : isMobile ? "236px" : "306px",
|
height: spec ? "auto" : isMobile ? "236px" : "306px",
|
||||||
borderRadius: "8px",
|
borderRadius: "12px",
|
||||||
objectFit: "contain",
|
objectFit: "cover",
|
||||||
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
@ -148,9 +166,10 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
resultQuestion.description !== " " && (
|
resultQuestion.description !== " " && (
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: "24px",
|
fontSize: "27px",
|
||||||
|
lineHeight: "32px",
|
||||||
fontWeight: 700,
|
fontWeight: 700,
|
||||||
mt: "25px",
|
mt: "30px",
|
||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
wordBreak: "break-word",
|
wordBreak: "break-word",
|
||||||
}}
|
}}
|
||||||
@ -161,7 +180,9 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
|
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
mt: "20px",
|
mt: "12px",
|
||||||
|
fontSize: "17px",
|
||||||
|
lineHeight: "20px",
|
||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
wordBreak: "break-word",
|
wordBreak: "break-word",
|
||||||
}}
|
}}
|
||||||
@ -173,8 +194,9 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
resultQuestion.content.text !== " " && (
|
resultQuestion.content.text !== " " && (
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: "18px",
|
fontSize: "17px",
|
||||||
mt: "30px ",
|
lineHeight: "20px",
|
||||||
|
mt: "25px ",
|
||||||
wordBreak: "break-word",
|
wordBreak: "break-word",
|
||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
}}
|
}}
|
||||||
@ -183,29 +205,24 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
<Box width="100%">
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
width: "100%",
|
|
||||||
justifyContent: "end",
|
|
||||||
px: "20px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{show_badge && (
|
{show_badge && (
|
||||||
<Box
|
<Box
|
||||||
component={Link}
|
component={Link}
|
||||||
target={"_blank"}
|
target={"_blank"}
|
||||||
href={`https://${window.location.hostname.includes("s") ? "s" : ""
|
href={`https://${
|
||||||
|
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",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
mt: "15px",
|
alignSelf: isMobile ? "center" : "end",
|
||||||
|
margin: isMobile ? "15px 0 0" : "15px 25px 0 0",
|
||||||
gap: "10px",
|
gap: "10px",
|
||||||
textDecoration: "none",
|
textDecoration: "none",
|
||||||
mb: "15px",
|
mb: "15px",
|
||||||
|
position: isTablet || isMobile ? "sticky" : "absolute",
|
||||||
|
bottom: "90px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NameplateLogo
|
<NameplateLogo
|
||||||
@ -216,27 +233,19 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
: "#F5F7FF",
|
: "#F5F7FF",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
// 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",
|
||||||
borderTop: "1px solid #9A9AAF80",
|
borderTop: "1px solid #9A9AAF80",
|
||||||
p:
|
p: "20px",
|
||||||
(settings.cfg.resultInfo.showResultForm === "before" &&
|
position: "sticky",
|
||||||
!settings.cfg.score) ||
|
bottom: 0,
|
||||||
(settings.cfg.resultInfo.showResultForm === "after" &&
|
|
||||||
resultQuestion.content.redirect)
|
|
||||||
? "20px"
|
|
||||||
: "0",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{settings.cfg.resultInfo.showResultForm === "before" &&
|
{settings.cfg.resultInfo.showResultForm === "before" &&
|
||||||
@ -262,7 +271,10 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
: `https://${resultQuestion.content.redirect}`
|
: `https://${resultQuestion.content.redirect}`
|
||||||
}
|
}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
sx={{ p: "10px 20px", width: "auto", height: "50px" }}
|
sx={{
|
||||||
|
p: "10px 20px",
|
||||||
|
width: "auto",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{resultQuestion.content.hint.text || "Перейти на сайт"}
|
{resultQuestion.content.hint.text || "Перейти на сайт"}
|
||||||
</Button>
|
</Button>
|
||||||
@ -270,6 +282,5 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user