2023-11-14 13:13:10 +00:00
|
|
|
|
import AlignCenterIcon from "@icons/AlignCenterIcon";
|
2023-10-31 13:37:30 +00:00
|
|
|
|
import AlignLeftIcon from "@icons/AlignLeftIcon";
|
|
|
|
|
import AlignRightIcon from "@icons/AlignRightIcon";
|
|
|
|
|
import ArrowDown from "@icons/ArrowDownIcon";
|
2023-12-16 00:31:40 +00:00
|
|
|
|
import ArrowLeft from "@icons/ArrowLeftSP";
|
2023-10-31 13:37:30 +00:00
|
|
|
|
import LayoutCenteredIcon from "@icons/LayoutCenteredIcon";
|
|
|
|
|
import LayoutExpandedIcon from "@icons/LayoutExpandedIcon";
|
|
|
|
|
import LayoutStandartIcon from "@icons/LayoutStandartIcon";
|
|
|
|
|
import MobilePhoneIcon from "@icons/MobilePhoneIcon";
|
2023-11-14 13:13:10 +00:00
|
|
|
|
import { QuizStartpageType } from "@model/quizSettings";
|
|
|
|
|
import {
|
2023-12-18 15:04:09 +00:00
|
|
|
|
Box,
|
|
|
|
|
Button,
|
|
|
|
|
Checkbox,
|
|
|
|
|
FormControl,
|
|
|
|
|
FormControlLabel,
|
|
|
|
|
MenuItem,
|
|
|
|
|
Select,
|
|
|
|
|
Typography,
|
|
|
|
|
useMediaQuery,
|
|
|
|
|
useTheme,
|
2023-11-14 13:13:10 +00:00
|
|
|
|
} from "@mui/material";
|
2023-12-31 02:53:25 +00:00
|
|
|
|
import {
|
|
|
|
|
incrementCurrentStep,
|
|
|
|
|
updateQuiz,
|
|
|
|
|
uploadQuizImage,
|
|
|
|
|
} from "@root/quizes/actions";
|
2023-11-14 13:13:10 +00:00
|
|
|
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
|
|
|
|
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
|
|
|
|
import CustomTextField from "@ui_kit/CustomTextField";
|
2023-05-10 17:35:30 +00:00
|
|
|
|
import SelectableButton from "@ui_kit/SelectableButton";
|
2023-11-14 13:13:10 +00:00
|
|
|
|
import { StartPagePreview } from "@ui_kit/StartPagePreview";
|
2023-12-08 16:23:06 +00:00
|
|
|
|
import { resizeFavIcon } from "@ui_kit/reactImageFileResizer";
|
2023-11-14 13:13:10 +00:00
|
|
|
|
import { useState } from "react";
|
|
|
|
|
import { createPortal } from "react-dom";
|
2023-12-08 16:23:06 +00:00
|
|
|
|
import FaviconDropZone from "./FaviconDropZone";
|
2023-06-17 22:26:12 +00:00
|
|
|
|
import ModalSizeImage from "./ModalSizeImage";
|
2023-11-14 13:13:10 +00:00
|
|
|
|
import SelectableIconButton from "./SelectableIconButton";
|
2023-11-01 13:31:15 +00:00
|
|
|
|
import { DropZone } from "./dropZone";
|
2023-11-14 13:13:10 +00:00
|
|
|
|
import Extra from "./extra";
|
|
|
|
|
|
2022-12-26 10:00:03 +00:00
|
|
|
|
const designTypes = [
|
2023-12-31 02:53:25 +00:00
|
|
|
|
[
|
|
|
|
|
"standard",
|
|
|
|
|
(color: string) => <LayoutStandartIcon color={color} />,
|
|
|
|
|
"Standard",
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"expanded",
|
|
|
|
|
(color: string) => <LayoutExpandedIcon color={color} />,
|
|
|
|
|
"Expanded",
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"centered",
|
|
|
|
|
(color: string) => <LayoutCenteredIcon color={color} />,
|
|
|
|
|
"Centered",
|
|
|
|
|
],
|
2022-12-26 10:00:03 +00:00
|
|
|
|
] as const;
|
2023-06-10 07:33:16 +00:00
|
|
|
|
// type DesignType = typeof designTypes[number][0];
|
2022-12-26 10:00:03 +00:00
|
|
|
|
|
2023-10-05 10:12:56 +00:00
|
|
|
|
export default function StartPageSettings() {
|
2023-12-18 15:04:09 +00:00
|
|
|
|
const theme = useTheme();
|
|
|
|
|
const isSmallMonitor = useMediaQuery(theme.breakpoints.down(1500));
|
|
|
|
|
const isTablet = useMediaQuery(theme.breakpoints.down(950));
|
|
|
|
|
const quiz = useCurrentQuiz();
|
|
|
|
|
const [formState, setFormState] = useState<"design" | "content">("design");
|
|
|
|
|
const [mobileVersion, setMobileVersion] = useState(false);
|
2023-12-08 16:23:06 +00:00
|
|
|
|
|
2023-12-18 15:04:09 +00:00
|
|
|
|
if (!quiz) return null;
|
2023-12-11 16:54:35 +00:00
|
|
|
|
|
2023-12-18 15:04:09 +00:00
|
|
|
|
const MobileVersionHC = (bool: boolean) => {
|
|
|
|
|
setMobileVersion(bool);
|
|
|
|
|
};
|
2023-12-11 16:54:35 +00:00
|
|
|
|
|
2023-12-18 15:04:09 +00:00
|
|
|
|
const designType = quiz?.config?.startpageType;
|
2022-12-26 10:00:03 +00:00
|
|
|
|
|
2023-12-18 15:04:09 +00:00
|
|
|
|
const favIconDropZoneElement = (
|
|
|
|
|
<FaviconDropZone
|
|
|
|
|
imageUrl={quiz.config.startpage.favIcon}
|
|
|
|
|
onImageUploadClick={async (file) => {
|
|
|
|
|
const resizedImage = await resizeFavIcon(file);
|
|
|
|
|
uploadQuizImage(quiz.id, resizedImage, (quiz, url) => {
|
|
|
|
|
quiz.config.startpage.favIcon = url;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
onDeleteClick={() => {
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.favIcon = null;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
);
|
2023-12-06 12:54:33 +00:00
|
|
|
|
|
2023-12-18 15:04:09 +00:00
|
|
|
|
return (
|
|
|
|
|
<>
|
2023-12-31 02:53:25 +00:00
|
|
|
|
<Typography
|
|
|
|
|
variant="h5"
|
|
|
|
|
sx={{ marginTop: "60px", marginBottom: isSmallMonitor ? "0" : "40px" }}
|
|
|
|
|
>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
Стартовая страница
|
|
|
|
|
</Typography>
|
|
|
|
|
{isSmallMonitor && (
|
|
|
|
|
<Box sx={{ display: "flex", gap: "5px", margin: "20px 0px 10px" }}>
|
|
|
|
|
<Button onClick={() => setFormState("design")}>
|
2023-10-19 10:55:37 +00:00
|
|
|
|
<Typography
|
2023-12-18 15:04:09 +00:00
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
color: formState === "design" ? "#7E2AEA" : "#7D7E86",
|
2023-12-31 02:53:25 +00:00
|
|
|
|
borderBottom:
|
|
|
|
|
formState === "design"
|
|
|
|
|
? "2px solid #7E2AEA"
|
|
|
|
|
: "1px solid transparent",
|
2023-12-18 15:04:09 +00:00
|
|
|
|
}}
|
2023-10-19 10:55:37 +00:00
|
|
|
|
>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
Дизайн
|
2023-10-19 10:55:37 +00:00
|
|
|
|
</Typography>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
</Button>
|
|
|
|
|
<Button onClick={() => setFormState("content")}>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
color: formState === "content" ? "#7E2AEA" : "#7D7E86",
|
2023-12-31 02:53:25 +00:00
|
|
|
|
borderBottom:
|
|
|
|
|
formState === "content"
|
|
|
|
|
? "2px solid #7E2AEA"
|
|
|
|
|
: "1px solid transparent",
|
2023-12-18 15:04:09 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Контент
|
|
|
|
|
</Typography>
|
|
|
|
|
</Button>
|
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
boxSizing: "border-box",
|
|
|
|
|
backgroundColor: "white",
|
|
|
|
|
borderRadius: "12px",
|
|
|
|
|
p: "20px",
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
maxWidth: "1160px",
|
|
|
|
|
width: "100%",
|
|
|
|
|
boxShadow: `0px 100px 309px rgba(210, 208, 225, 0.24),
|
2022-12-26 10:00:03 +00:00
|
|
|
|
0px 41.7776px 129.093px rgba(210, 208, 225, 0.172525),
|
|
|
|
|
0px 22.3363px 69.0192px rgba(210, 208, 225, 0.143066),
|
|
|
|
|
0px 12.5216px 38.6916px rgba(210, 208, 225, 0.12),
|
|
|
|
|
0px 6.6501px 20.5488px rgba(210, 208, 225, 0.0969343),
|
|
|
|
|
0px 2.76726px 8.55082px rgba(210, 208, 225, 0.0674749)`,
|
2023-12-18 15:04:09 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{(!isSmallMonitor || (isSmallMonitor && formState === "design")) && (
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
pr: "20px",
|
2023-12-31 02:53:25 +00:00
|
|
|
|
borderRight: `1px solid ${
|
|
|
|
|
isTablet ? "transparent" : theme.palette.grey2.main
|
|
|
|
|
}`,
|
2023-12-18 15:04:09 +00:00
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
flex: `1 1 361px`,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Дизайн
|
|
|
|
|
</Typography>
|
|
|
|
|
<FormControl
|
|
|
|
|
fullWidth
|
|
|
|
|
size="small"
|
|
|
|
|
sx={{
|
|
|
|
|
width: "100%",
|
|
|
|
|
minWidth: "200px",
|
|
|
|
|
height: "48px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Select
|
|
|
|
|
id="category-select"
|
|
|
|
|
variant="outlined"
|
|
|
|
|
value={designType}
|
|
|
|
|
displayEmpty
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
2023-12-31 02:53:25 +00:00
|
|
|
|
quiz.config.startpageType = e.target
|
|
|
|
|
.value as QuizStartpageType;
|
2023-12-18 15:04:09 +00:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
sx={{
|
|
|
|
|
height: "48px",
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
"& .MuiOutlinedInput-notchedOutline": {
|
|
|
|
|
border: `1px solid ${theme.palette.brightPurple.main} !important`,
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
MenuProps={{
|
|
|
|
|
PaperProps: {
|
|
|
|
|
sx: {
|
|
|
|
|
mt: "8px",
|
|
|
|
|
p: "4px",
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
border: "1px solid #EEE4FC",
|
|
|
|
|
boxShadow: "0px 8px 24px rgba(210, 208, 225, 0.4)",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
MenuListProps: {
|
|
|
|
|
sx: {
|
|
|
|
|
py: 0,
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
gap: "8px",
|
|
|
|
|
"& .Mui-selected": {
|
|
|
|
|
backgroundColor: theme.palette.background.default,
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
inputProps={{
|
|
|
|
|
sx: {
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
px: "9px",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
},
|
2023-10-19 10:55:37 +00:00
|
|
|
|
}}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
IconComponent={(props) => <ArrowDown {...props} />}
|
|
|
|
|
>
|
|
|
|
|
{designTypes.map((type) => (
|
|
|
|
|
<MenuItem
|
|
|
|
|
key={type[0]}
|
|
|
|
|
value={type[0]}
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
p: "4px",
|
|
|
|
|
borderRadius: "5px",
|
|
|
|
|
color: theme.palette.grey2.main,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-12-31 02:53:25 +00:00
|
|
|
|
{type[1](
|
|
|
|
|
type[0] === designType
|
|
|
|
|
? theme.palette.orange.main
|
|
|
|
|
: theme.palette.grey2.main,
|
|
|
|
|
)}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
{type[2]}
|
|
|
|
|
</MenuItem>
|
|
|
|
|
))}
|
|
|
|
|
</Select>
|
|
|
|
|
</FormControl>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
2023-07-30 21:25:47 +00:00
|
|
|
|
>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
Фон
|
|
|
|
|
</Typography>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: "10px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<SelectableButton
|
|
|
|
|
isSelected={quiz.config.startpage.background.type === "image"}
|
|
|
|
|
onClick={() =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.background.type = "image";
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
Изображение
|
|
|
|
|
</SelectableButton>
|
|
|
|
|
<SelectableButton
|
|
|
|
|
isSelected={quiz.config.startpage.background.type === "video"}
|
|
|
|
|
onClick={() =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.background.type = "video";
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
Видео
|
|
|
|
|
</SelectableButton>
|
|
|
|
|
</Box>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
|
2023-12-18 15:04:09 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2023-12-31 02:53:25 +00:00
|
|
|
|
display:
|
|
|
|
|
quiz.config.startpage.background.type === "image"
|
|
|
|
|
? "flex"
|
|
|
|
|
: "none",
|
2023-12-18 15:04:09 +00:00
|
|
|
|
flexDirection: "column",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: mobileVersion ? "none" : "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Изображение
|
|
|
|
|
</Typography>
|
|
|
|
|
<DropZone
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={"5 MB максимум"}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
sx={{ maxWidth: "300px" }}
|
|
|
|
|
imageUrl={quiz.config.startpage.background.desktop}
|
2023-12-31 02:53:25 +00:00
|
|
|
|
originalImageUrl={
|
|
|
|
|
quiz.config.startpage.background.originalDesktop
|
|
|
|
|
}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
onImageUploadClick={(file) => {
|
|
|
|
|
uploadQuizImage(quiz.id, file, (quiz, url) => {
|
|
|
|
|
quiz.config.startpage.background.desktop = url;
|
|
|
|
|
quiz.config.startpage.background.originalDesktop = url;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
onImageSaveClick={(file) => {
|
|
|
|
|
uploadQuizImage(quiz.id, file, (quiz, url) => {
|
|
|
|
|
quiz.config.startpage.background.desktop = url;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
onDeleteClick={() => {
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.background.desktop = null;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
2023-10-19 10:55:37 +00:00
|
|
|
|
|
2023-12-18 15:04:09 +00:00
|
|
|
|
<ModalSizeImage />
|
|
|
|
|
</Box>
|
2023-12-13 20:36:17 +00:00
|
|
|
|
|
2023-12-18 15:04:09 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2023-12-31 02:53:25 +00:00
|
|
|
|
display:
|
|
|
|
|
quiz.config.startpage.background.type === "image"
|
|
|
|
|
? "none"
|
|
|
|
|
: "flex",
|
2023-12-18 15:04:09 +00:00
|
|
|
|
flexDirection: "column",
|
|
|
|
|
mt: "20px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<CustomTextField
|
|
|
|
|
placeholder="URL видео"
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={quiz.config.startpage.background.video ?? ""}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.background.video = e.target.value;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
2023-06-07 14:20:45 +00:00
|
|
|
|
|
2023-12-18 15:04:09 +00:00
|
|
|
|
{designType !== "centered" && (
|
|
|
|
|
<>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Расположение элементов
|
|
|
|
|
</Typography>
|
2023-11-14 13:13:10 +00:00
|
|
|
|
<Box
|
2023-12-18 15:04:09 +00:00
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: "10px",
|
|
|
|
|
}}
|
2023-10-19 10:55:37 +00:00
|
|
|
|
>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
<SelectableIconButton
|
|
|
|
|
onClick={() =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.position = "left";
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
isActive={quiz.config.startpage.position === "left"}
|
|
|
|
|
Icon={AlignLeftIcon}
|
|
|
|
|
/>
|
|
|
|
|
<SelectableIconButton
|
|
|
|
|
onClick={() =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.position = "center";
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
isActive={quiz.config.startpage.position === "center"}
|
|
|
|
|
Icon={AlignCenterIcon}
|
2023-12-31 02:53:25 +00:00
|
|
|
|
sx={{
|
|
|
|
|
display: designType === "standard" ? "none" : "flex",
|
|
|
|
|
}}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
/>
|
|
|
|
|
<SelectableIconButton
|
|
|
|
|
onClick={() =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.position = "right";
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
isActive={quiz.config.startpage.position === "right"}
|
|
|
|
|
Icon={AlignRightIcon}
|
|
|
|
|
/>
|
2023-11-14 13:13:10 +00:00
|
|
|
|
</Box>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
{(isTablet || !isSmallMonitor) && (
|
|
|
|
|
<>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2023-12-31 02:53:25 +00:00
|
|
|
|
display:
|
|
|
|
|
quiz.config.startpage.background.type === "image"
|
|
|
|
|
? "flex"
|
|
|
|
|
: "none",
|
2023-12-18 15:04:09 +00:00
|
|
|
|
flexDirection: "column",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
margin: "20px 0",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Логотип
|
|
|
|
|
</Typography>
|
|
|
|
|
<DropZone
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={"5 MB максимум"}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
sx={{ maxWidth: "300px" }}
|
|
|
|
|
imageUrl={quiz.config.startpage.logo}
|
|
|
|
|
originalImageUrl={quiz.config.startpage.originalLogo}
|
|
|
|
|
onImageUploadClick={(file) => {
|
|
|
|
|
uploadQuizImage(quiz.id, file, (quiz, url) => {
|
|
|
|
|
quiz.config.startpage.logo = url;
|
|
|
|
|
quiz.config.startpage.originalLogo = url;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
onImageSaveClick={(file) => {
|
|
|
|
|
uploadQuizImage(quiz.id, file, (quiz, url) => {
|
|
|
|
|
quiz.config.startpage.logo = url;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
onDeleteClick={() => {
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.logo = null;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2023-11-14 13:13:10 +00:00
|
|
|
|
</Box>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Favicon
|
|
|
|
|
</Typography>
|
|
|
|
|
{favIconDropZoneElement}
|
|
|
|
|
</>
|
2023-11-14 13:13:10 +00:00
|
|
|
|
)}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
{/*Правая сторона*/}
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: isTablet && formState === "design" ? "none" : "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
flex: `1 1 795px`,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{!isTablet && isSmallMonitor && formState === "design" && (
|
|
|
|
|
<>
|
|
|
|
|
<Box
|
2023-10-19 10:55:37 +00:00
|
|
|
|
sx={{
|
2023-12-31 02:53:25 +00:00
|
|
|
|
display:
|
|
|
|
|
quiz.config.startpage.background.type === "image"
|
|
|
|
|
? "flex"
|
|
|
|
|
: "none",
|
2023-12-18 15:04:09 +00:00
|
|
|
|
flexDirection: "column",
|
2023-10-19 10:55:37 +00:00
|
|
|
|
}}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
marginBottom: "15px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Логотип
|
|
|
|
|
</Typography>
|
|
|
|
|
<DropZone
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={"5 MB максимум"}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
sx={{ maxWidth: "300px" }}
|
|
|
|
|
imageUrl={quiz.config.startpage.logo}
|
|
|
|
|
originalImageUrl={quiz.config.startpage.originalLogo}
|
|
|
|
|
onImageUploadClick={(file) => {
|
|
|
|
|
uploadQuizImage(quiz.id, file, (quiz, url) => {
|
|
|
|
|
quiz.config.startpage.logo = url;
|
|
|
|
|
quiz.config.startpage.originalLogo = url;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
onImageSaveClick={(file) => {
|
|
|
|
|
uploadQuizImage(quiz.id, file, (quiz, url) => {
|
|
|
|
|
quiz.config.startpage.logo = url;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
onDeleteClick={() => {
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.logo = null;
|
|
|
|
|
});
|
|
|
|
|
}}
|
2023-11-14 13:13:10 +00:00
|
|
|
|
/>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Favicon
|
|
|
|
|
</Typography>
|
|
|
|
|
{favIconDropZoneElement}
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
{(!isSmallMonitor || (isSmallMonitor && formState === "content")) && (
|
|
|
|
|
<>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Заголовок
|
|
|
|
|
</Typography>
|
|
|
|
|
<CustomTextField
|
2023-12-30 20:31:49 +00:00
|
|
|
|
placeholder="Имя заголовка опроса для подбора табуретки"
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={quiz.name}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.name = e.target.value;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
maxLength={40}
|
|
|
|
|
/>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Текст
|
|
|
|
|
</Typography>
|
|
|
|
|
<CustomTextField
|
|
|
|
|
placeholder="Внимательно заполняйте поля ответов"
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={quiz.config.startpage.description}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.description = e.target.value;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
maxLength={70}
|
|
|
|
|
/>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Текст кнопки
|
|
|
|
|
</Typography>
|
|
|
|
|
<CustomTextField
|
|
|
|
|
placeholder="Начать опрос"
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={quiz.config.startpage.button}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.startpage.button = e.target.value;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
maxLength={15}
|
|
|
|
|
/>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Телефон
|
|
|
|
|
</Typography>
|
|
|
|
|
<CustomTextField
|
|
|
|
|
placeholder="8-800-000-00-00"
|
2023-12-28 20:08:41 +00:00
|
|
|
|
type="number"
|
|
|
|
|
value={quiz.config.info.phonenumber}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.info.phonenumber = e.target.value;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
maxLength={20}
|
|
|
|
|
/>
|
|
|
|
|
<CustomCheckbox
|
|
|
|
|
sx={{ margin: "10px 0" }}
|
|
|
|
|
label="Кликабельный"
|
|
|
|
|
checked={quiz.config.info.clickable}
|
|
|
|
|
handleChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.info.clickable = e.target.checked;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "11px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Название или слоган компании
|
|
|
|
|
</Typography>
|
|
|
|
|
<CustomTextField
|
|
|
|
|
placeholder="Только лучшее"
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={quiz.config.info.orgname}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.info.orgname = e.target.value;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
maxLength={25}
|
|
|
|
|
/>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Сайт
|
|
|
|
|
</Typography>
|
|
|
|
|
<CustomTextField
|
|
|
|
|
placeholder="https://mysite.com"
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={quiz.config.info.site}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.info.site = e.target.value;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
maxLength={25}
|
|
|
|
|
/>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "14px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Юридическая информация
|
|
|
|
|
</Typography>
|
|
|
|
|
<CustomTextField
|
|
|
|
|
placeholder="Данные наших документов"
|
2023-12-28 20:08:41 +00:00
|
|
|
|
value={quiz.config.info.law}
|
2023-12-18 15:04:09 +00:00
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.info.law = e.target.value;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
maxLength={45}
|
|
|
|
|
/>
|
|
|
|
|
<Extra />
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
{isSmallMonitor && (
|
|
|
|
|
<Box sx={{ maxWidth: "1160px", marginBottom: "60px" }}>
|
|
|
|
|
{formState === "content" && (
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() => setFormState("design")}
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
marginTop: "20px",
|
|
|
|
|
padding: "0",
|
|
|
|
|
fontWeight: "bold",
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
color: "#7E2AEA",
|
|
|
|
|
textDecoration: "underline",
|
|
|
|
|
textUnderlineOffset: "2px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<ArrowLeft right={false} /> Вернуться к дизайну
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
{formState === "design" && (
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() => setFormState("content")}
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
marginLeft: "auto",
|
|
|
|
|
marginTop: "20px",
|
|
|
|
|
padding: "0",
|
|
|
|
|
fontWeight: "bold",
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
color: "#7E2AEA",
|
|
|
|
|
textDecoration: "underline",
|
|
|
|
|
textUnderlineOffset: "2px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Далее заполнить контент <ArrowLeft right={true} />
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
maxWidth: "1160px",
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
justifyContent: "flex-end",
|
|
|
|
|
flexDirection: isTablet ? "column" : "row",
|
|
|
|
|
marginTop: "30px",
|
|
|
|
|
marginBottom: isTablet ? "90px" : undefined,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<FormControlLabel
|
|
|
|
|
control={
|
|
|
|
|
<Checkbox
|
|
|
|
|
icon={
|
2023-09-18 12:34:41 +00:00
|
|
|
|
<Button
|
2023-12-18 15:04:09 +00:00
|
|
|
|
variant="outlined"
|
|
|
|
|
sx={{
|
|
|
|
|
backgroundColor: "transparent",
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
}}
|
2023-09-18 12:34:41 +00:00
|
|
|
|
>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
Отключить стартовую страницу
|
2023-07-30 21:25:47 +00:00
|
|
|
|
</Button>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
}
|
|
|
|
|
checkedIcon={
|
|
|
|
|
<Button
|
|
|
|
|
variant="outlined"
|
|
|
|
|
sx={{
|
|
|
|
|
backgroundColor: theme.palette.brightPurple.main,
|
|
|
|
|
color: "white",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Включить стартовую страницу
|
|
|
|
|
</Button>
|
|
|
|
|
}
|
|
|
|
|
sx={{
|
|
|
|
|
borderRadius: 0,
|
|
|
|
|
padding: 0,
|
|
|
|
|
}}
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateQuiz(quiz.id, (quiz) => {
|
|
|
|
|
quiz.config.noStartPage = e.target.checked;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
checked={quiz.config.noStartPage}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
label=""
|
|
|
|
|
sx={{
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
margin: "0",
|
|
|
|
|
userSelect: "none",
|
|
|
|
|
justifyContent: "flex-end",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2023-12-31 02:53:25 +00:00
|
|
|
|
<Button
|
|
|
|
|
variant="contained"
|
|
|
|
|
data-cy="setup-questions"
|
|
|
|
|
onClick={incrementCurrentStep}
|
|
|
|
|
>
|
2023-12-18 15:04:09 +00:00
|
|
|
|
Настроить вопросы
|
|
|
|
|
</Button>
|
|
|
|
|
</Box>
|
|
|
|
|
{createPortal(<StartPagePreview />, document.body)}
|
|
|
|
|
</>
|
|
|
|
|
);
|
2022-12-26 10:00:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-17 14:26:27 +00:00
|
|
|
|
function IconCheck() {
|
2023-12-18 15:04:09 +00:00
|
|
|
|
return (
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
height: "36px",
|
|
|
|
|
width: "36px",
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
backgroundColor: "#EEE4FC",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
);
|
2023-07-30 21:25:47 +00:00
|
|
|
|
}
|