2023-09-15 12:37:12 +00:00
|
|
|
|
import Stepper from "@ui_kit/Stepper";
|
2023-06-30 14:39:07 +00:00
|
|
|
|
import SwitchStepPages from "@ui_kit/switchStepPages";
|
2023-09-20 17:39:17 +00:00
|
|
|
|
import React, { useState } from "react";
|
2023-05-31 10:50:30 +00:00
|
|
|
|
import PenaLogo from "@ui_kit/PenaLogo";
|
2023-10-05 10:12:56 +00:00
|
|
|
|
import {
|
|
|
|
|
Box,
|
|
|
|
|
Button,
|
|
|
|
|
Container,
|
|
|
|
|
FormControl,
|
|
|
|
|
IconButton,
|
|
|
|
|
TextField,
|
|
|
|
|
useMediaQuery,
|
|
|
|
|
useTheme,
|
|
|
|
|
} from "@mui/material";
|
2023-10-10 08:30:36 +00:00
|
|
|
|
import { Link } from "react-router-dom";
|
2023-05-31 10:50:30 +00:00
|
|
|
|
import BackArrowIcon from "@icons/BackArrowIcon";
|
|
|
|
|
import NavMenuItem from "@ui_kit/Header/NavMenuItem";
|
|
|
|
|
import EyeIcon from "@icons/EyeIcon";
|
|
|
|
|
import CustomAvatar from "@ui_kit/Header/Avatar";
|
|
|
|
|
import Sidebar from "@ui_kit/Sidebar";
|
2023-09-15 12:37:12 +00:00
|
|
|
|
import { quizStore } from "@root/quizes";
|
|
|
|
|
import { useParams } from "react-router-dom";
|
2023-09-21 07:00:08 +00:00
|
|
|
|
import { Burger } from "@icons/Burger";
|
|
|
|
|
import { PenaLogoIcon } from "@icons/PenaLogoIcon";
|
|
|
|
|
import { SidebarMobile } from "./Sidebar/SidebarMobile";
|
|
|
|
|
|
2023-10-05 10:12:56 +00:00
|
|
|
|
const DESCRIPTIONS = [
|
|
|
|
|
"Настройка стартовой страницы",
|
|
|
|
|
"Задайте вопросы",
|
|
|
|
|
"Настройте авторезультаты",
|
2023-10-19 15:14:07 +00:00
|
|
|
|
"Оценка графа карты вопросов",
|
2023-10-05 10:12:56 +00:00
|
|
|
|
"Настройте форму контактов",
|
|
|
|
|
"Установите квиз",
|
|
|
|
|
"Запустите рекламу",
|
|
|
|
|
] as const;
|
|
|
|
|
|
2023-09-15 12:37:12 +00:00
|
|
|
|
export default function StartPage() {
|
|
|
|
|
const { listQuizes, updateQuizesList, removeQuiz, createBlank } = quizStore();
|
|
|
|
|
const params = Number(useParams().quizId);
|
|
|
|
|
const activeStep = listQuizes[params].step;
|
|
|
|
|
const theme = useTheme();
|
|
|
|
|
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
2023-09-21 07:00:08 +00:00
|
|
|
|
const isMobile = useMediaQuery(theme.breakpoints.down(660));
|
|
|
|
|
|
2023-09-20 17:39:17 +00:00
|
|
|
|
const [mobileSidebar, setMobileSidebar] = useState<boolean>(false);
|
2023-09-21 07:00:08 +00:00
|
|
|
|
|
2023-09-15 12:37:12 +00:00
|
|
|
|
const handleBack = () => {
|
|
|
|
|
let result = listQuizes[params].step - 1;
|
|
|
|
|
updateQuizesList(params, { step: result ? result : 1 });
|
|
|
|
|
};
|
2023-03-03 23:54:19 +00:00
|
|
|
|
|
2023-09-15 12:37:12 +00:00
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
{/*хедер*/}
|
|
|
|
|
<Container
|
|
|
|
|
component="nav"
|
|
|
|
|
maxWidth={false}
|
|
|
|
|
disableGutters
|
|
|
|
|
sx={{
|
|
|
|
|
px: "16px",
|
|
|
|
|
display: "flex",
|
2023-09-21 07:00:08 +00:00
|
|
|
|
height: isMobile ? "51px" : "80px",
|
2023-09-15 12:37:12 +00:00
|
|
|
|
alignItems: "center",
|
2023-09-21 07:00:08 +00:00
|
|
|
|
bgcolor: isMobile ? "#333647" : "white",
|
2023-09-15 12:37:12 +00:00
|
|
|
|
borderBottom: "1px solid #E3E3E3",
|
|
|
|
|
zIndex: theme.zIndex.drawer + 1,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-10-10 08:30:36 +00:00
|
|
|
|
<Link to="/" style={{ display: "flex" }}>
|
|
|
|
|
{isMobile ? (
|
|
|
|
|
<PenaLogoIcon style={{ fontSize: "39px", color: "white" }} />
|
|
|
|
|
) : (
|
|
|
|
|
<PenaLogo width={124} />
|
|
|
|
|
)}
|
|
|
|
|
</Link>
|
2023-09-15 12:37:12 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2023-09-21 07:00:08 +00:00
|
|
|
|
display: isMobile ? "none" : "flex",
|
2023-09-15 12:37:12 +00:00
|
|
|
|
alignItems: "center",
|
|
|
|
|
ml: "37px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<IconButton sx={{ p: "6px" }} onClick={() => handleBack()}>
|
|
|
|
|
<BackArrowIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
<FormControl fullWidth variant="standard">
|
|
|
|
|
<TextField
|
|
|
|
|
fullWidth
|
|
|
|
|
id="project-name"
|
|
|
|
|
placeholder="Название проекта окно"
|
|
|
|
|
sx={{
|
|
|
|
|
width: "270px",
|
|
|
|
|
"& .MuiInputBase-root": {
|
|
|
|
|
height: "34px",
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
p: 0,
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
inputProps={{
|
|
|
|
|
sx: {
|
|
|
|
|
height: "20px",
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
lineHeight: "20px",
|
|
|
|
|
p: "7px",
|
|
|
|
|
color: "black",
|
|
|
|
|
"&::placeholder": {
|
|
|
|
|
opacity: 1,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</FormControl>
|
|
|
|
|
</Box>
|
|
|
|
|
{isTablet ? (
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
ml: "auto",
|
2023-05-31 10:50:30 +00:00
|
|
|
|
}}
|
2023-09-15 12:37:12 +00:00
|
|
|
|
>
|
2023-09-21 07:00:08 +00:00
|
|
|
|
{isMobile ? (
|
|
|
|
|
<Burger
|
|
|
|
|
onClick={() => setMobileSidebar(!mobileSidebar)}
|
|
|
|
|
style={{ fontSize: "30px", color: "white", cursor: "pointer" }}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<CustomAvatar
|
2023-10-05 10:12:56 +00:00
|
|
|
|
sx={{
|
|
|
|
|
ml: "11px",
|
|
|
|
|
backgroundColor: theme.palette.orange.main,
|
|
|
|
|
height: "36px",
|
|
|
|
|
width: "36px",
|
|
|
|
|
}}
|
2023-09-21 07:00:08 +00:00
|
|
|
|
/>
|
|
|
|
|
)}
|
2023-09-15 12:37:12 +00:00
|
|
|
|
</Box>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: "30px",
|
|
|
|
|
overflow: "hidden",
|
|
|
|
|
ml: "20px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<NavMenuItem text="Редактировать" isActive />
|
|
|
|
|
<NavMenuItem text="Заявки" />
|
|
|
|
|
<NavMenuItem text="Аналитика" />
|
|
|
|
|
<NavMenuItem text="История" />
|
|
|
|
|
<NavMenuItem text="Помощь" />
|
|
|
|
|
</Box>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
ml: "auto",
|
|
|
|
|
gap: "15px",
|
|
|
|
|
}}
|
2023-05-31 10:50:30 +00:00
|
|
|
|
>
|
2023-09-15 12:37:12 +00:00
|
|
|
|
<Button
|
|
|
|
|
variant="outlined"
|
|
|
|
|
startIcon={<EyeIcon />}
|
|
|
|
|
sx={{
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
fontSize: "14px",
|
|
|
|
|
lineHeight: "18px",
|
|
|
|
|
height: "34px",
|
|
|
|
|
"& .MuiButton-startIcon": {
|
|
|
|
|
mr: "3px",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Предпросмотр
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="contained"
|
|
|
|
|
sx={{
|
|
|
|
|
fontSize: "14px",
|
|
|
|
|
lineHeight: "18px",
|
|
|
|
|
height: "34px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Опубликовать
|
|
|
|
|
</Button>
|
|
|
|
|
<CustomAvatar
|
2023-10-05 10:12:56 +00:00
|
|
|
|
sx={{
|
|
|
|
|
ml: "11px",
|
|
|
|
|
backgroundColor: theme.palette.orange.main,
|
|
|
|
|
height: "36px",
|
|
|
|
|
width: "36px",
|
|
|
|
|
}}
|
2023-09-15 12:37:12 +00:00
|
|
|
|
/>
|
2023-05-31 10:50:30 +00:00
|
|
|
|
</Box>
|
2023-09-15 12:37:12 +00:00
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Container>
|
|
|
|
|
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2023-09-21 07:00:08 +00:00
|
|
|
|
display: isMobile ? "block" : "flex",
|
2023-09-15 12:37:12 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2023-09-21 07:00:08 +00:00
|
|
|
|
{isMobile ? <SidebarMobile open={mobileSidebar} /> : <Sidebar />}
|
2023-09-15 12:37:12 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
background: theme.palette.background.default,
|
|
|
|
|
width: "100%",
|
2023-09-25 13:43:15 +00:00
|
|
|
|
padding: isMobile ? "16px" : "25px",
|
2023-09-15 12:37:12 +00:00
|
|
|
|
height: "calc(100vh - 80px)",
|
|
|
|
|
overflow: "auto",
|
|
|
|
|
boxSizing: "border-box",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-10-05 10:12:56 +00:00
|
|
|
|
<Stepper
|
|
|
|
|
activeStep={activeStep}
|
|
|
|
|
desc={DESCRIPTIONS[activeStep - 1]}
|
|
|
|
|
/>
|
|
|
|
|
<SwitchStepPages
|
|
|
|
|
activeStep={activeStep}
|
|
|
|
|
quizType={listQuizes[params].config.type}
|
|
|
|
|
startpage={listQuizes[params].startpage}
|
|
|
|
|
createResult={listQuizes[params].createResult}
|
|
|
|
|
/>
|
2023-09-15 12:37:12 +00:00
|
|
|
|
</Box>
|
2023-10-31 13:37:30 +00:00
|
|
|
|
{isTablet && activeStep === 1 && (
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
position: "absolute",
|
|
|
|
|
left: isMobile ? 0 : "230px",
|
|
|
|
|
bottom: 0,
|
|
|
|
|
width: isMobile ? "100%" : "calc(100% - 230px)",
|
|
|
|
|
padding: "20px 40px",
|
|
|
|
|
display: "flex",
|
|
|
|
|
justifyContent: "flex-end",
|
|
|
|
|
gap: "15px",
|
|
|
|
|
background: "#FFF",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
variant="outlined"
|
|
|
|
|
startIcon={<EyeIcon />}
|
|
|
|
|
sx={{
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
fontSize: "14px",
|
|
|
|
|
lineHeight: "18px",
|
|
|
|
|
height: "34px",
|
|
|
|
|
"& .MuiButton-startIcon": {
|
|
|
|
|
mr: "3px",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Предпросмотр
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="contained"
|
|
|
|
|
sx={{
|
|
|
|
|
fontSize: "14px",
|
|
|
|
|
lineHeight: "18px",
|
|
|
|
|
height: "34px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Опубликовать
|
|
|
|
|
</Button>
|
|
|
|
|
</Box>
|
|
|
|
|
)}
|
2023-09-15 12:37:12 +00:00
|
|
|
|
</Box>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|