frontPanel/src/pages/startPage/StartPageSettings.tsx

925 lines
44 KiB
TypeScript
Raw Normal View History

2023-11-14 13:13:10 +00:00
import AlignCenterIcon from "@icons/AlignCenterIcon";
import AlignLeftIcon from "@icons/AlignLeftIcon";
import AlignRightIcon from "@icons/AlignRightIcon";
import ArrowDown from "@icons/ArrowDownIcon";
import InfoIcon from "@icons/InfoIcon";
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 {
Box,
Button,
ButtonBase,
Checkbox,
FormControl,
FormControlLabel,
MenuItem,
Select,
Tooltip,
Typography,
useMediaQuery,
useTheme,
} from "@mui/material";
2023-12-03 17:23:28 +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";
import SelectableButton from "@ui_kit/SelectableButton";
2023-11-14 13:13:10 +00:00
import { StartPagePreview } from "@ui_kit/StartPagePreview";
import UploadBox from "@ui_kit/UploadBox";
2023-11-14 13:13:10 +00:00
import { useState } from "react";
import { createPortal } from "react-dom";
import UploadIcon from "../../assets/icons/UploadIcon";
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";
2023-12-06 12:54:33 +00:00
import { resizeFavIcon } from "@ui_kit/reactImageFileResizer";
import FaviconDropZone from "./FaviconDropZone";
2023-11-14 13:13:10 +00:00
2022-12-26 10:00:03 +00:00
const designTypes = [
2023-11-14 13:13:10 +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;
// 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-11-14 13:13:10 +00:00
const theme = useTheme();
const isSmallMonitor = useMediaQuery(theme.breakpoints.down(1500));
const isTablet = useMediaQuery(theme.breakpoints.down(950));
2023-11-27 23:07:24 +00:00
const quiz = useCurrentQuiz();
2023-11-14 13:13:10 +00:00
const [formState, setFormState] = useState<"design" | "content">("design");
2023-11-14 13:13:10 +00:00
const designType = quiz?.config?.startpageType;
2023-11-14 13:13:10 +00:00
const videoHC = (videoInp: HTMLInputElement) => {
const file = videoInp.files?.[0];
2023-11-14 13:13:10 +00:00
if (file) {
setVideo(URL.createObjectURL(file));
}
};
2023-11-14 13:13:10 +00:00
const [video, setVideo] = useState("");
2023-11-14 13:13:10 +00:00
const [mobileVersion, setMobileVersion] = useState(false);
const MobileVersionHC = (bool: boolean) => {
setMobileVersion(bool);
};
2023-12-01 18:05:59 +00:00
2023-11-14 13:13:10 +00:00
if (!quiz) return null; // TODO throw and catch with error boundary
2022-12-26 10:00:03 +00:00
2023-12-06 12:54:33 +00:00
const favIconDropZoneElement = (
<FaviconDropZone
2023-12-06 12:54:33 +00:00
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-11-14 13:13:10 +00:00
return (
<>
2023-10-19 10:55:37 +00:00
<Typography
2023-11-14 13:13:10 +00:00
variant="h5"
sx={{ marginTop: "60px", marginBottom: isSmallMonitor ? "0" : "40px" }}
2023-10-19 10:55:37 +00:00
>
2023-11-14 13:13:10 +00:00
Стартовая страница
2023-10-19 10:55:37 +00:00
</Typography>
2023-11-14 13:13:10 +00:00
{isSmallMonitor && (
<Box sx={{ display: "flex", gap: "5px", margin: "20px 0px 10px" }}>
<Button onClick={() => setFormState("design")}>
<Typography
sx={{
fontWeight: 500,
fontSize: "16px",
color: formState === "design" ? "#7E2AEA" : "#7D7E86",
borderBottom:
formState === "design"
? "2px solid #7E2AEA"
: "1px solid transparent",
}}
>
Дизайн
</Typography>
</Button>
<Button onClick={() => setFormState("content")}>
<Typography
sx={{
fontWeight: 500,
fontSize: "16px",
color: formState === "content" ? "#7E2AEA" : "#7D7E86",
borderBottom:
formState === "content"
? "2px solid #7E2AEA"
: "1px solid transparent",
}}
>
Контент
</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-10-19 10:55:37 +00:00
}}
>
2023-11-14 13:13:10 +00:00
{(!isSmallMonitor || (isSmallMonitor && formState === "design")) && (
<Box
sx={{
pr: "20px",
borderRight: `1px solid ${isTablet ? "transparent" : theme.palette.grey2.main
}`,
display: "flex",
flexDirection: "column",
flex: `1 1 361px`,
2023-11-14 13:13:10 +00:00
}}
>
<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
2023-11-27 23:07:24 +00:00
onChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.startpageType = e.target.value as QuizStartpageType;
})}
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",
},
}}
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,
}}
>
{type[1](
type[0] === designType
? theme.palette.orange.main
: theme.palette.grey2.main
)}
{type[2]}
</MenuItem>
))}
</Select>
</FormControl>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "20px",
mb: "14px",
}}
>
Фон
</Typography>
<Box
sx={{
display: "flex",
gap: "10px",
}}
>
<SelectableButton
isSelected={quiz.config.startpage.background.type === "image"}
2023-11-27 23:07:24 +00:00
onClick={() => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.startpage.background.type = "image";
})}
>
Изображение
</SelectableButton>
<SelectableButton
isSelected={quiz.config.startpage.background.type === "video"}
2023-11-27 23:07:24 +00:00
onClick={() => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.startpage.background.type = "video";
})}
>
Видео
</SelectableButton>
</Box>
2023-11-14 13:13:10 +00:00
<Box
sx={{
display: quiz.config.startpage.background.type === "image" ? "flex" : "none",
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
text={"5 MB максимум"}
sx={{ maxWidth: "300px" }}
2023-12-01 18:05:59 +00:00
imageUrl={quiz.config.startpage.background.desktop}
2023-12-04 11:57:54 +00:00
originalImageUrl={quiz.config.startpage.background.originalDesktop}
onImageUploadClick={file => {
uploadQuizImage(quiz.id, file, (quiz, url) => {
quiz.config.startpage.background.desktop = url;
quiz.config.startpage.background.originalDesktop = url;
});
}}
onImageSaveClick={file => {
2023-12-03 17:23:28 +00:00
uploadQuizImage(quiz.id, file, (quiz, url) => {
quiz.config.startpage.background.desktop = url;
});
}}
onDeleteClick={() => {
updateQuiz(quiz.id, quiz => {
quiz.config.startpage.background.desktop = null;
});
2023-12-01 18:05:59 +00:00
}}
2023-11-14 13:13:10 +00:00
/>
</Box>
2023-10-19 10:55:37 +00:00
2023-11-14 13:13:10 +00:00
<ModalSizeImage />
2023-10-19 10:55:37 +00:00
2023-11-14 13:13:10 +00:00
<Box
sx={{
mt: "10px",
2023-11-14 13:13:10 +00:00
display: "flex",
gap: "10px",
flexDirection: "column",
}}
>
<FormControlLabel
control={
<Checkbox
icon={<IconCheck />}
checkedIcon={<MobilePhoneIcon bgcolor={"#EEE4FC"} />}
/>
}
label="мобильная версия"
sx={{
color: theme.palette.brightPurple.main,
textDecorationLine: "underline",
textDecorationColor: theme.palette.brightPurple.main,
ml: "-9px",
userSelect: "none",
"& .css-14o5ia4-MuiTypography-root": {
fontSize: "16px"
}
2023-11-14 13:13:10 +00:00
}}
onClick={() => {
MobileVersionHC(!mobileVersion);
}}
/>
{mobileVersion ? (
<Box sx={{ display: "flex", flexDirection: "column" }}>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "11px",
mb: "14px",
}}
>
Изображение для мобильной версии
</Typography>
2023-12-01 18:05:59 +00:00
<DropZone
text={"5 MB максимум"}
imageUrl={quiz.config.startpage.background.mobile}
2023-12-04 11:57:54 +00:00
originalImageUrl={quiz.config.startpage.background.originalMobile}
onImageUploadClick={file => {
uploadQuizImage(quiz.id, file, (quiz, url) => {
quiz.config.startpage.background.mobile = url;
quiz.config.startpage.background.originalMobile = url;
});
}}
onImageSaveClick={file => {
2023-12-03 17:23:28 +00:00
uploadQuizImage(quiz.id, file, (quiz, url) => {
quiz.config.startpage.background.mobile = url;
});
}}
onDeleteClick={() => {
updateQuiz(quiz.id, quiz => {
quiz.config.startpage.background.mobile = null;
});
2023-12-01 18:05:59 +00:00
}}
/>
2023-11-14 13:13:10 +00:00
</Box>
) : (
<></>
)}
</Box>
</Box>
2023-11-14 13:13:10 +00:00
<Box
sx={{
display: quiz.config.startpage.background.type === "image" ? "none" : "flex",
flexDirection: "column",
}}
>
<Box
sx={{
display: "flex",
alignItems: "center",
gap: "7px",
mt: "20px",
mb: "14px",
}}
>
<Typography
sx={{ fontWeight: 500, color: theme.palette.grey3.main }}
>
Добавить видео
</Typography>
<Tooltip title="Можно загрузить видео." placement="top">
<Box>
<InfoIcon />
</Box>
</Tooltip>
</Box>
<ButtonBase
component="label"
sx={{ justifyContent: "flex-start" }}
>
<input
onChange={(event) => videoHC(event.target)}
hidden
accept=".mp4"
multiple
type="file"
/>
<UploadBox
icon={<UploadIcon />}
sx={{
height: "48px",
width: "48px",
marginBottom: "20px",
}}
/>
</ButtonBase>
{video ? <video src={video} width="400" controls /> : null}
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "20px",
mb: "5px",
}}
>
Настройки видео
</Typography>
<CustomCheckbox
label="Зацикливать видео"
checked={quiz.config.startpage.background.cycle}
2023-11-27 23:07:24 +00:00
handleChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.startpage.background.cycle = e.target.checked;
})}
/>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "11px",
mb: "14px",
}}
>
Изображение для мобильной версии
</Typography>
2023-12-01 18:05:59 +00:00
<DropZone
text={"5 MB максимум"}
imageUrl={quiz.config.startpage.background.mobile}
2023-12-04 11:57:54 +00:00
originalImageUrl={quiz.config.startpage.background.originalMobile}
onImageUploadClick={file => {
uploadQuizImage(quiz.id, file, (quiz, url) => {
quiz.config.startpage.background.mobile = url;
quiz.config.startpage.background.originalMobile = url;
});
}}
onImageSaveClick={file => {
2023-12-03 17:23:28 +00:00
uploadQuizImage(quiz.id, file, (quiz, url) => {
quiz.config.startpage.background.mobile = url;
});
}}
onDeleteClick={() => {
updateQuiz(quiz.id, quiz => {
quiz.config.startpage.background.mobile = null;
});
2023-12-01 18:05:59 +00:00
}}
/>
2023-11-14 13:13:10 +00:00
</Box>
2023-10-19 10:55:37 +00:00
2023-11-14 13:13:10 +00:00
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "20px",
mb: "14px",
}}
>
Расположение элементов
</Typography>
<Box
sx={{
display: "flex",
gap: "10px",
}}
>
<SelectableIconButton
2023-11-27 23:07:24 +00:00
onClick={() => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.startpage.position = "left";
})}
isActive={quiz.config.startpage.position === "left"}
Icon={AlignLeftIcon}
/>
<SelectableIconButton
2023-11-27 23:07:24 +00:00
onClick={() => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.startpage.position = "center";
})}
isActive={quiz.config.startpage.position === "center"}
Icon={AlignCenterIcon}
sx={{ display: designType === "centered" ? "flex" : "none" }}
/>
<SelectableIconButton
2023-11-27 23:07:24 +00:00
onClick={() => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.startpage.position = "right";
})}
isActive={quiz.config.startpage.position === "right"}
Icon={AlignRightIcon}
/>
</Box>
2023-11-14 13:13:10 +00:00
{(isTablet || !isSmallMonitor) && (
<>
<Box
sx={{
display: quiz.config.startpage.background.type === "image" ? "flex" : "none",
flexDirection: "column",
}}
>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
margin: "20px 0",
}}
>
Логотип
</Typography>
<DropZone
text={"5 MB максимум"}
sx={{ maxWidth: "300px" }}
2023-12-06 16:41:17 +00:00
imageUrl={quiz.config.startpage.logo}
originalImageUrl={quiz.config.startpage.originalLogo}
2023-12-04 11:57:54 +00:00
onImageUploadClick={file => {
uploadQuizImage(quiz.id, file, (quiz, url) => {
2023-12-06 16:41:17 +00:00
quiz.config.startpage.logo = url;
quiz.config.startpage.originalLogo = url;
2023-12-04 11:57:54 +00:00
});
}}
onImageSaveClick={file => {
2023-12-03 17:23:28 +00:00
uploadQuizImage(quiz.id, file, (quiz, url) => {
2023-12-06 16:41:17 +00:00
quiz.config.startpage.logo = url;
2023-12-03 17:23:28 +00:00
});
}}
onDeleteClick={() => {
updateQuiz(quiz.id, quiz => {
2023-12-06 16:41:17 +00:00
quiz.config.startpage.logo = null;
2023-12-03 17:23:28 +00:00
});
2023-12-01 18:05:59 +00:00
}}
2023-11-14 13:13:10 +00:00
/>
</Box>
2023-11-14 13:13:10 +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
</>
)}
</Box>
)}
{/*Правая сторона*/}
<Box
2023-10-19 10:55:37 +00:00
sx={{
2023-11-14 13:13:10 +00:00
display: isTablet && formState === "design" ? "none" : "flex",
flexDirection: "column",
flex: `1 1 795px`,
2023-10-19 10:55:37 +00:00
}}
>
2023-11-14 13:13:10 +00:00
{!isTablet && isSmallMonitor && formState === "design" && (
<>
<Box
sx={{
display: quiz.config.startpage.background.type === "image" ? "flex" : "none",
flexDirection: "column",
}}
>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
marginBottom: "15px",
}}
>
Логотип
</Typography>
<DropZone
text={"5 MB максимум"}
sx={{ maxWidth: "300px" }}
2023-12-06 16:41:17 +00:00
imageUrl={quiz.config.startpage.logo}
originalImageUrl={quiz.config.startpage.originalLogo}
2023-12-04 11:57:54 +00:00
onImageUploadClick={file => {
uploadQuizImage(quiz.id, file, (quiz, url) => {
2023-12-06 16:41:17 +00:00
quiz.config.startpage.logo = url;
quiz.config.startpage.originalLogo = url;
2023-12-04 11:57:54 +00:00
});
}}
onImageSaveClick={file => {
2023-12-03 17:23:28 +00:00
uploadQuizImage(quiz.id, file, (quiz, url) => {
2023-12-06 16:41:17 +00:00
quiz.config.startpage.logo = url;
2023-12-03 17:23:28 +00:00
});
}}
onDeleteClick={() => {
updateQuiz(quiz.id, quiz => {
2023-12-06 16:41:17 +00:00
quiz.config.startpage.logo = null;
2023-12-03 17:23:28 +00:00
});
2023-12-01 18:05:59 +00:00
}}
2023-11-14 13:13:10 +00:00
/>
</Box>
2023-10-19 10:55:37 +00:00
2023-11-14 13:13:10 +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
</>
)}
{(!isSmallMonitor || (isSmallMonitor && formState === "content")) && (
<>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mb: "14px",
}}
>
Заголовок
</Typography>
<CustomTextField
2023-12-02 15:57:32 +00:00
placeholder="Имя заголовка об опроснике для подбора табуретки"
2023-11-14 13:13:10 +00:00
text={quiz.name}
2023-11-27 23:07:24 +00:00
onChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.name = e.target.value;
})}
/>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "20px",
mb: "14px",
}}
>
Текст
</Typography>
<CustomTextField
2023-12-02 15:57:32 +00:00
placeholder="Внимательно заполняйте поля ответов"
2023-11-14 13:13:10 +00:00
text={quiz.config.startpage.description}
2023-11-27 23:07:24 +00:00
onChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.startpage.description = e.target.value;
})}
/>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "20px",
mb: "14px",
}}
>
Текст кнопки
</Typography>
<CustomTextField
2023-12-02 15:57:32 +00:00
placeholder="Начать опрос"
2023-11-14 13:13:10 +00:00
text={quiz.config.startpage.button}
2023-11-27 23:07:24 +00:00
onChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.startpage.button = e.target.value;
})}
/>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "20px",
mb: "14px",
}}
>
Телефон
</Typography>
<CustomTextField
2023-12-02 15:57:32 +00:00
placeholder="8-800-000-00-00"
2023-11-14 13:13:10 +00:00
text={quiz.config.info.phonenumber}
2023-11-27 23:07:24 +00:00
onChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.info.phonenumber = e.target.value;
})}
/>
<CustomCheckbox
2023-12-03 17:23:28 +00:00
sx={{ margin: "10px 0" }}
2023-11-14 13:13:10 +00:00
label="Кликабельный"
checked={quiz.config.info.clickable}
2023-11-27 23:07:24 +00:00
handleChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.info.clickable = e.target.checked;
})}
/>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "11px",
mb: "14px",
}}
>
Название или слоган компании
</Typography>
<CustomTextField
2023-12-02 15:57:32 +00:00
placeholder="Только лучшее"
2023-11-14 13:13:10 +00:00
text={quiz.config.info.orgname}
2023-11-27 23:07:24 +00:00
onChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.info.orgname = e.target.value;
})}
/>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "20px",
mb: "14px",
}}
>
Сайт
</Typography>
<CustomTextField
2023-12-02 15:57:32 +00:00
placeholder="https://mysite.com"
2023-11-14 13:13:10 +00:00
text={quiz.config.info.site}
2023-11-27 23:07:24 +00:00
onChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.info.site = e.target.value;
})}
/>
<Typography
sx={{
fontWeight: 500,
color: theme.palette.grey3.main,
mt: "20px",
mb: "14px",
}}
>
Юридическая информация
</Typography>
<CustomTextField
2023-12-02 15:57:32 +00:00
placeholder="Данные наших документов"
2023-11-14 13:13:10 +00:00
text={quiz.config.info.law}
2023-11-27 23:07:24 +00:00
onChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
quiz.config.info.law = e.target.value;
})}
/>
<Extra />
</>
)}
</Box>
</Box>
{isSmallMonitor && (
<Box sx={{ maxWidth: "1160px", marginBottom: "60px" }}>
{formState === "content" && (
<Button
onClick={() => setFormState("design")}
sx={{
display: "block",
marginTop: "20px",
padding: "0",
fontWeight: "bold",
fontSize: "16px",
color: "#7E2AEA",
textDecoration: "underline",
textUnderlineOffset: "2px",
}}
>
🡰 Вернуться к дизайну
</Button>
)}
{formState === "design" && (
<Button
onClick={() => setFormState("content")}
sx={{
display: "block",
marginLeft: "auto",
marginTop: "20px",
padding: "0",
fontWeight: "bold",
fontSize: "16px",
color: "#7E2AEA",
textDecoration: "underline",
textUnderlineOffset: "2px",
}}
>
Далее заполнить контент 🡲
</Button>
)}
</Box>
)}
<Box
2023-10-19 10:55:37 +00:00
sx={{
2023-11-14 13:13:10 +00:00
maxWidth: "1160px",
display: "flex",
gap: "20px",
justifyContent: "flex-end",
flexDirection: isTablet ? "column" : "row",
marginTop: "30px",
marginBottom: isTablet ? "90px" : undefined
2023-10-19 10:55:37 +00:00
}}
2023-10-31 13:07:01 +00:00
>
2023-11-14 13:13:10 +00:00
<FormControlLabel
control={
<Checkbox
icon={
<Button
variant="outlined"
sx={{
backgroundColor: "transparent",
color: theme.palette.brightPurple.main,
}}
>
Отключить стартовую страницу
</Button>
}
checkedIcon={
<Button
variant="outlined"
sx={{
backgroundColor: theme.palette.brightPurple.main,
color: "white",
}}
>
Включить стартовую страницу
</Button>
}
sx={{
borderRadius: 0,
padding: 0,
}}
2023-11-27 23:07:24 +00:00
onChange={e => updateQuiz(quiz.id, quiz => {
2023-11-14 13:13:10 +00:00
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-09-18 12:34:41 +00:00
<Button
2023-11-14 13:13:10 +00:00
variant="contained"
data-cy="setup-questions"
2023-11-27 23:07:24 +00:00
onClick={incrementCurrentStep}
2023-09-18 12:34:41 +00:00
>
2023-11-14 13:13:10 +00:00
Настроить вопросы
</Button>
2023-11-14 13:13:10 +00:00
</Box>
{createPortal(<StartPagePreview />, document.body)}
</>
);
2022-12-26 10:00:03 +00:00
}
function IconCheck() {
2023-11-14 13:13:10 +00:00
return (
<Box
sx={{
height: "36px",
width: "36px",
borderRadius: "8px",
backgroundColor: "#EEE4FC",
}}
/>
);
}