Merge branch 'dev' into 'main'

Dev

See merge request frontend/squiz!30
This commit is contained in:
Nastya 2023-10-16 18:18:40 +00:00
commit 062d253601
15 changed files with 339 additions and 180 deletions

@ -49,7 +49,10 @@ import { ArrowDownIcon } from "@icons/questionsPage/ArrowDownIcon";
import { ReactComponent as PlusIcon } from "../../../assets/icons/plus.svg"; import { ReactComponent as PlusIcon } from "../../../assets/icons/plus.svg";
import type { DraggableProvidedDragHandleProps } from "react-beautiful-dnd"; import type { DraggableProvidedDragHandleProps } from "react-beautiful-dnd";
import type { AnyQuizQuestion, QuizQuestionInitial } from "../../../model/questionTypes/shared"; import type {
AnyQuizQuestion,
QuizQuestionInitial,
} from "../../../model/questionTypes/shared";
interface Props { interface Props {
totalIndex: number; totalIndex: number;

@ -1,4 +1,4 @@
import { Box, Typography } from "@mui/material"; import { Box, Typography, useTheme, useMediaQuery } from "@mui/material";
type Props = { type Props = {
text: string; text: string;
@ -7,14 +7,20 @@ type Props = {
}; };
export default function CreationFullCard({ text, text2, image }: Props) { export default function CreationFullCard({ text, text2, image }: Props) {
const theme = useTheme();
const isSmallMonitor = useMediaQuery(theme.breakpoints.down(1500));
return ( return (
<Box <Box
sx={{ sx={{
flexGrow: 1, flexGrow: 1,
backgroundColor: "white", backgroundColor: "white",
p: "20px", p: "20px",
marginTop: "50px",
borderRadius: "12px", borderRadius: "12px",
display: "flex", display: isSmallMonitor ? "block" : "flex",
flexDirection: isSmallMonitor ? "column" : "row",
gap: "20px",
boxShadow: `0px 100px 309px rgba(210, 208, 225, 0.24), boxShadow: `0px 100px 309px rgba(210, 208, 225, 0.24),
0px 41.7776px 129.093px rgba(210, 208, 225, 0.172525), 0px 41.7776px 129.093px rgba(210, 208, 225, 0.172525),
0px 22.3363px 69.0192px rgba(210, 208, 225, 0.143066), 0px 22.3363px 69.0192px rgba(210, 208, 225, 0.143066),
@ -23,36 +29,46 @@ export default function CreationFullCard({ text, text2, image }: Props) {
0px 2.76726px 8.55082px rgba(210, 208, 225, 0.0674749)`, 0px 2.76726px 8.55082px rgba(210, 208, 225, 0.0674749)`,
}} }}
> >
<Box sx={{ mr: "104px", position: "relative" }}> <Box
<Typography variant="h5">Результаты квиза в зависимости от ответов</Typography> sx={{
<Typography mr: !isSmallMonitor ? "104px" : 0,
marginBottom: "20px",
position: "relative",
}}
>
<Typography variant="h5" sx={{ marginBottom: "20px" }}>
Результаты квиза в зависимости от ответов
</Typography>
<Box
sx={{ sx={{
color: "#4D4D4D", display: "flex",
mt: "20px", flexDirection: "column",
mb: "33px", justifyContent: "space-between",
width: "95%", height: "100%",
maxHeight: isSmallMonitor ? "none" : "220px",
gap: "25px",
}} }}
> >
{text} <Typography sx={{ color: "#4D4D4D", width: "95%" }}>
</Typography> {text}
<Typography </Typography>
sx={{ <Typography
color: "#9A9AAF", sx={{
width: "100%", color: "#9A9AAF",
position: "absolute", width: "100%",
bottom: 0, }}
}} >
> {text2}
{text2} </Typography>
</Typography> </Box>
</Box> </Box>
<img <img
src={image} src={image}
alt="quiz creation" alt="quiz creation"
style={{ style={{
display: "block", display: "block",
width: "520px", width: isSmallMonitor ? "100%" : "auto",
height: "270xp", maxHeight: isSmallMonitor ? "none" : "270px",
}} }}
/> />
</Box> </Box>

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { Box, IconButton, useTheme } from "@mui/material"; import { Box, IconButton, useTheme, useMediaQuery } from "@mui/material";
import MiniButtonSetting from "@ui_kit/MiniButtonSetting"; import MiniButtonSetting from "@ui_kit/MiniButtonSetting";
import SettingIcon from "@icons/questionsPage/settingIcon"; import SettingIcon from "@icons/questionsPage/settingIcon";
import Branching from "@icons/questionsPage/branching"; import Branching from "@icons/questionsPage/branching";
@ -15,20 +15,39 @@ interface Props {
export default function ButtonsOptionsForm({ SSHC, switchState }: Props) { export default function ButtonsOptionsForm({ SSHC, switchState }: Props) {
const theme = useTheme(); const theme = useTheme();
const isTablet = useMediaQuery(theme.breakpoints.down(800));
const buttonSetting: { icon: JSX.Element; title: string; value: string }[] = [ const buttonSetting: { icon: JSX.Element; title: string; value: string }[] = [
{ {
icon: <SettingIcon color={switchState === "setting" ? "#ffffff" : theme.palette.grey3.main} />, icon: (
<SettingIcon
color={
switchState === "setting" ? "#ffffff" : theme.palette.grey3.main
}
/>
),
title: "Настройки", title: "Настройки",
value: "setting", value: "setting",
}, },
{ {
icon: <Branching color={switchState === "branching" ? "#ffffff" : theme.palette.grey3.main} />, icon: (
<Branching
color={
switchState === "branching" ? "#ffffff" : theme.palette.grey3.main
}
/>
),
title: "Ветвление", title: "Ветвление",
value: "branching", value: "branching",
}, },
{ {
icon: <StarIconPoints color={switchState === "points" ? "#ffffff" : theme.palette.grey3.main} />, icon: (
<StarIconPoints
color={
switchState === "points" ? "#ffffff" : theme.palette.grey3.main
}
/>
),
title: "Баллы", title: "Баллы",
value: "points", value: "points",
}, },
@ -47,6 +66,7 @@ export default function ButtonsOptionsForm({ SSHC, switchState }: Props) {
sx={{ sx={{
padding: "20px", padding: "20px",
display: "flex", display: "flex",
flexWrap: "wrap",
gap: "10px", gap: "10px",
}} }}
> >
@ -57,18 +77,23 @@ export default function ButtonsOptionsForm({ SSHC, switchState }: Props) {
SSHC(value); SSHC(value);
}} }}
sx={{ sx={{
backgroundColor: switchState === value ? theme.palette.brightPurple.main : "transparent", backgroundColor:
color: switchState === value ? "#ffffff" : theme.palette.grey3.main, switchState === value
? theme.palette.brightPurple.main
: "transparent",
color:
switchState === value ? "#ffffff" : theme.palette.grey3.main,
}} }}
> >
{icon} {icon}
{title} {!isTablet && title}
</MiniButtonSetting> </MiniButtonSetting>
))} ))}
</Box> </Box>
<Box <Box
sx={{ sx={{
padding: "20px", padding: "20px",
display: "flex",
}} }}
> >
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}> <IconButton sx={{ borderRadius: "6px", padding: "2px" }}>

@ -31,10 +31,12 @@ export const DescriptionForm = () => {
return ( return (
<Box <Box
sx={{ sx={{
width: "796px", overflow: "hidden",
maxWidth: "796px",
height: "100%", height: "100%",
bgcolor: "#FFFFFF", bgcolor: "#FFFFFF",
borderRadius: "12px", borderRadius: "12px",
boxShadow: "0px 10px 30px #e7e7e7",
}} }}
> >
<Box sx={{ p: "0 20px", pt: "30px" }}> <Box sx={{ p: "0 20px", pt: "30px" }}>
@ -57,7 +59,10 @@ export const DescriptionForm = () => {
</Box> </Box>
<Box sx={{ display: "flex" }}> <Box sx={{ display: "flex" }}>
<PriceButtons ButtonsActive={buttonsActive} priceButtonsActive={priceButtonsActive} /> <PriceButtons
ButtonsActive={buttonsActive}
priceButtonsActive={priceButtonsActive}
/>
<DiscountButtons /> <DiscountButtons />
</Box> </Box>
@ -85,7 +90,10 @@ export const DescriptionForm = () => {
{priceButtonsType === "smooth" ? ( {priceButtonsType === "smooth" ? (
<Box sx={{ mb: "20px" }}> <Box sx={{ mb: "20px" }}>
<Box sx={{ display: "flex", alignItems: "center", mb: "14xp" }}> <Box sx={{ display: "flex", alignItems: "center", mb: "14xp" }}>
<Typography component={"h6"} sx={{ weight: "500", fontSize: "18px" }}> <Typography
component={"h6"}
sx={{ weight: "500", fontSize: "18px" }}
>
Призыв к действию Призыв к действию
</Typography> </Typography>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}> <IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
@ -127,8 +135,13 @@ export const DescriptionForm = () => {
</Button> </Button>
{forwarding ? ( {forwarding ? (
<Box sx={{ ml: "20px", mt: "-36px" }}> <Box sx={{ ml: "20px", mt: "-36px" }}>
<Box sx={{ display: "flex", alignItems: "center", mb: "14xp" }}> <Box
<Typography component={"h6"} sx={{ weight: "500", fontSize: "18px" }}> sx={{ display: "flex", alignItems: "center", mb: "14xp" }}
>
<Typography
component={"h6"}
sx={{ weight: "500", fontSize: "18px" }}
>
Переадресация Переадресация
</Typography> </Typography>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}> <IconButton sx={{ borderRadius: "6px", padding: "2px" }}>

@ -14,7 +14,10 @@ export default function DiscountButtons() {
<DeleteIcon style={{ color: "#4D4D4D" }} /> <DeleteIcon style={{ color: "#4D4D4D" }} />
</IconButton> </IconButton>
</Box> </Box>
<Box component="div" sx={{ mb: "20px" }}> <Box
component="div"
sx={{ display: "flex", gap: "8px", flexWrap: "wrap", mb: "20px" }}
>
<Button <Button
variant="contained" variant="contained"
sx={{ sx={{

@ -1,4 +1,4 @@
import { Box, Typography, useTheme } from "@mui/material"; import { Box, Typography, useTheme, useMediaQuery } from "@mui/material";
import AddImage from "@icons/questionsPage/addImage"; import AddImage from "@icons/questionsPage/addImage";
import AddVideofile from "@icons/questionsPage/addVideofile"; import AddVideofile from "@icons/questionsPage/addVideofile";
@ -7,11 +7,20 @@ import { CropModal } from "@ui_kit/Modal/CropModal";
export default function ImageAndVideoButtons() { export default function ImageAndVideoButtons() {
const theme = useTheme(); const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down(400));
const [opened, setOpened] = useState<boolean>(false); const [opened, setOpened] = useState<boolean>(false);
return ( return (
<Box sx={{ display: "flex", alignItems: "center", gap: "12px", mt: "20px", mb: "20px" }}> <Box
sx={{
display: "flex",
alignItems: "center",
gap: "12px",
mt: "20px",
mb: "20px",
}}
>
<AddImage onClick={() => setOpened(true)} /> <AddImage onClick={() => setOpened(true)} />
<CropModal opened={opened} onClose={() => setOpened(false)} /> <CropModal opened={opened} onClose={() => setOpened(false)} />
<Typography <Typography
@ -22,7 +31,7 @@ export default function ImageAndVideoButtons() {
color: theme.palette.grey2.main, color: theme.palette.grey2.main,
}} }}
> >
Изображение {!isMobile && "Изображение"}
</Typography> </Typography>
<Typography> или</Typography> <Typography> или</Typography>
<AddVideofile /> <AddVideofile />
@ -34,7 +43,7 @@ export default function ImageAndVideoButtons() {
color: theme.palette.grey2.main, color: theme.palette.grey2.main,
}} }}
> >
Видео {!isMobile && "Видео"}
</Typography> </Typography>
</Box> </Box>
); );

@ -1,66 +1,73 @@
import { Box, Button, IconButton, SxProps, Theme, Typography } from "@mui/material"; import {
Box,
Button,
IconButton,
SxProps,
Theme,
Typography,
} from "@mui/material";
import { DeleteIcon } from "@icons/questionsPage/deleteIcon"; import { DeleteIcon } from "@icons/questionsPage/deleteIcon";
const priceButtonsArray: { title: string; type: string; sx: SxProps<Theme> }[] = [ const priceButtonsArray: { title: string; type: string; sx: SxProps<Theme> }[] =
{ [
title: "10000 ₽", {
type: "10000 ₽", title: "10000 ₽",
sx: { type: "10000 ₽",
width: "110px", sx: {
height: "48px", width: "110px",
border: "1px solid #9A9AAF", height: "48px",
border: "1px solid #9A9AAF",
},
}, },
}, {
{ title: "Ровно",
title: "Ровно", type: "smooth",
type: "smooth", sx: {
sx: { width: "94px",
width: "94px", height: "48px",
height: "48px", border: "1px solid #9A9AAF",
ml: "8px", },
border: "1px solid #9A9AAF",
}, },
}, {
{ title: "От и до",
title: "От и до", type: "fromAndTo",
type: "fromAndTo", sx: {
sx: { width: "93px",
width: "93px", height: "48px",
height: "48px", border: "1px solid #9A9AAF",
ml: "8px", whiteSpace: "nowrap",
border: "1px solid #9A9AAF", },
whiteSpace: "nowrap",
}, },
}, {
{ title: "ƒ",
title: "ƒ", type: "ƒ",
type: "ƒ", sx: {
sx: { width: "38px",
width: "38px", height: "48px",
height: "48px", border: "1px solid #9A9AAF",
ml: "8px", },
border: "1px solid #9A9AAF",
}, },
}, {
{ title: "Скидка",
title: "Скидка", type: "discount",
type: "discount", sx: {
sx: { width: "93px",
width: "93px", height: "48px",
height: "48px", border: "1px solid #9A9AAF",
border: "1px solid #9A9AAF", },
ml: "8px",
}, },
}, ];
];
type Props = { type Props = {
ButtonsActive: (index: number, type: string) => void; ButtonsActive: (index: number, type: string) => void;
priceButtonsActive: number | undefined; priceButtonsActive: number | undefined;
}; };
export default function PriceButtons({ ButtonsActive, priceButtonsActive }: Props) { export default function PriceButtons({
ButtonsActive,
priceButtonsActive,
}: Props) {
return ( return (
<Box> <Box>
<Box sx={{ display: "flex", alignItems: "center", mb: "14xp" }}> <Box sx={{ display: "flex", alignItems: "center", mb: "14xp" }}>
@ -71,7 +78,10 @@ export default function PriceButtons({ ButtonsActive, priceButtonsActive }: Prop
<DeleteIcon style={{ color: "#4D4D4D" }} /> <DeleteIcon style={{ color: "#4D4D4D" }} />
</IconButton> </IconButton>
</Box> </Box>
<Box component="div" sx={{ mb: "20px" }}> <Box
component="div"
sx={{ display: "flex", flexWrap: "wrap", gap: "8px", mb: "20px" }}
>
{priceButtonsArray.map(({ title, type, sx }, index) => ( {priceButtonsArray.map(({ title, type, sx }, index) => (
<Button <Button
onClick={() => ButtonsActive(index, type)} onClick={() => ButtonsActive(index, type)}

@ -1,5 +1,5 @@
import { Link, useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { Box, Button, useTheme } from "@mui/material"; import { Box, Button, Tooltip, useTheme } from "@mui/material";
import CreationFullCard from "./CreationFullCard"; import CreationFullCard from "./CreationFullCard";
import Info from "../../assets/icons/Info"; import Info from "../../assets/icons/Info";
@ -21,19 +21,19 @@ export const Result = () => {
text2="Этот шаг - необязательный, квиз будет работать и без автоматических результатов." text2="Этот шаг - необязательный, квиз будет работать и без автоматических результатов."
image={image} image={image}
/> />
<Box sx={{ mt: "30px", alignItems: "center" }}> <Box sx={{ display: "flex", mt: "30px", alignItems: "center" }}>
<Button <Button
variant="contained" variant="contained"
sx={{ sx={{ mr: "15px", minWidth: "258px" }}
mr: "23px",
minWidth: "258px",
}}
onClick={handleNext} onClick={handleNext}
> >
Создать результаты Создать результаты
</Button> </Button>
<Tooltip title="Посмотреть справку" placement="top">
<Info /> <Box>
<Info />
</Box>
</Tooltip>
</Box> </Box>
</Box> </Box>
); );

@ -12,9 +12,11 @@ import CustomCheckbox from "@ui_kit/CustomCheckbox";
export const ResultListForm = () => { export const ResultListForm = () => {
const [alignType, setAlignType] = useState<"left" | "right">("left"); const [alignType, setAlignType] = useState<"left" | "right">("left");
const [proportions, setProportions] = useState<"oneOne" | "twoOne" | "oneTwo">("oneOne"); const [proportions, setProportions] = useState<
"oneOne" | "twoOne" | "oneTwo"
>("oneOne");
return ( return (
<Box sx={{ width: "796px", mb: "30px" }}> <Box sx={{ maxWidth: "796px", mb: "30px" }}>
<Box <Box
sx={{ sx={{
height: "100%", height: "100%",
@ -31,9 +33,17 @@ export const ResultListForm = () => {
mb: "20px", mb: "20px",
}} }}
> >
<Typography sx={{ color: "#9A9AAF" }}>Показывать результат</Typography> <Typography sx={{ color: "#9A9AAF" }}>
Показывать результат
</Typography>
<IconButton> <IconButton>
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg
width="30"
height="30"
viewBox="0 0 30 30"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect width="30" height="30" rx="6" fill="#EEE4FC" /> <rect width="30" height="30" rx="6" fill="#EEE4FC" />
<path <path
d="M22.5 11.25L15 18.75L7.5 11.25" d="M22.5 11.25L15 18.75L7.5 11.25"
@ -175,7 +185,7 @@ export const ResultListForm = () => {
/> />
</Box> </Box>
<Box sx={{ mt: "20px", display: "flex", alignItems: "center" }}> <Box sx={{ mt: "20px", display: "flex", alignItems: "center" }}>
<CustomCheckbox label={"Кнопка \"Не знаю, что выбрать\""}/> <CustomCheckbox label={'Кнопка "Не знаю, что выбрать"'} />
<Info /> <Info />
</Box> </Box>
</Box> </Box>

@ -8,18 +8,18 @@ import Info from "@icons/Info";
import IconPlus from "@icons/IconPlus"; import IconPlus from "@icons/IconPlus";
import ArrowLeft from "@icons/questionsPage/arrowLeft"; import ArrowLeft from "@icons/questionsPage/arrowLeft";
import React from "react"; import React from "react";
import {quizStore} from "@root/quizes"; import { quizStore } from "@root/quizes";
import {useParams} from "react-router-dom"; import { useParams } from "react-router-dom";
export const Setting = () => { export const Setting = () => {
const {listQuizes, updateQuizesList} = quizStore(); const { listQuizes, updateQuizesList } = quizStore();
const params = Number(useParams().quizId); const params = Number(useParams().quizId);
const handleNext = () => { const handleNext = () => {
updateQuizesList(params, {step: listQuizes[params].step + 1}) updateQuizesList(params, { step: listQuizes[params].step + 1 });
} };
const theme = useTheme(); const theme = useTheme();
return ( return (
<Box sx={{ width: "796px" }}> <Box sx={{ maxWidth: "796px" }}>
<Box sx={{ display: "flex", alignItems: "center", mb: "40px" }}> <Box sx={{ display: "flex", alignItems: "center", mb: "40px" }}>
<Typography sx={{ pr: "10px" }} variant="h5"> <Typography sx={{ pr: "10px" }} variant="h5">
Настройки результатов Настройки результатов
@ -46,7 +46,9 @@ export const Setting = () => {
</Box> </Box>
<CustomWrapper sx={{ mt: "30px" }} text="Показывать результат" /> <CustomWrapper sx={{ mt: "30px" }} text="Показывать результат" />
<CustomWrapper sx={{ mt: "30px" }} text="Настройки почты" /> <CustomWrapper sx={{ mt: "30px" }} text="Настройки почты" />
<Box sx={{ display: "flex", alignItems: "center", mb: "15px", mt: "15px" }}> <Box
sx={{ display: "flex", alignItems: "center", mb: "15px", mt: "15px" }}
>
<Typography variant="p1" sx={{ color: "#4D4D4D", fontSize: "14px" }}> <Typography variant="p1" sx={{ color: "#4D4D4D", fontSize: "14px" }}>
Создайте результат Создайте результат
</Typography> </Typography>
@ -70,22 +72,39 @@ export const Setting = () => {
</Button> </Button>
</Box> </Box>
<CustomWrapper result={true} text="Показывать результат" /> <CustomWrapper result={true} text="Показывать результат" />
<Box sx={{ width: "850px", display: "flex", alignItems: "center" }}> <Box
<Typography sx={{ color: "#7E2AEA", cursor: "default" }}> sx={{
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - display: "flex",
- - - - - - - width: "100%",
<IconPlus /> alignItems: "center",
</Typography> columnGap: "10px",
}}
>
<Box
sx={{
boxSizing: "border-box",
width: "100%",
height: "1px",
backgroundPosition: "bottom",
backgroundRepeat: "repeat-x",
backgroundSize: "20px 1px",
backgroundImage:
"radial-gradient(circle, #7E2AEA 6px, #F2F3F7 1px)",
}}
/>
<IconPlus />
</Box> </Box>
<CustomWrapper result={true} text="Настройки почты" /> <CustomWrapper result={true} text="Настройки почты" />
<Box sx={{ pt: "30px", display: "flex", alignItems: "center" }}> <Box sx={{ pt: "30px", display: "flex", alignItems: "center" }}>
<Plus /> <Plus />
<Typography component="div" sx={{ ml: "auto" }}> <Typography component="div" sx={{ ml: "auto" }}>
<Button variant='outlined' sx={{padding: '10px 20px', borderRadius: '8px'}}> <Button
<ArrowLeft/> variant="outlined"
</Button> sx={{ padding: "10px 20px", borderRadius: "8px" }}
<Button variant="contained" sx={{ml: "10px",}} onClick={handleNext}> >
<ArrowLeft />
</Button>
<Button variant="contained" sx={{ ml: "10px" }} onClick={handleNext}>
Настроить форму Настроить форму
</Button> </Button>
</Typography> </Typography>

@ -1,5 +1,14 @@
import { useState } from "react"; import { useState } from "react";
import { Box, Button, IconButton, SxProps, Theme, Typography } from "@mui/material"; import {
Box,
Button,
IconButton,
SxProps,
Theme,
Typography,
useTheme,
useMediaQuery,
} from "@mui/material";
import { SwitchSetting } from "./SwichResult"; import { SwitchSetting } from "./SwichResult";
import Info from "@icons/Info"; import Info from "@icons/Info";
@ -10,17 +19,35 @@ import ArrowCounterClockWise from "@icons/ArrowCounterClockWise.svg";
const buttonSetting: { title: string; sx: SxProps<Theme>; type: string }[] = [ const buttonSetting: { title: string; sx: SxProps<Theme>; type: string }[] = [
{ {
sx: { backgroundColor: "#7E2AEA", color: "white", width: "237px", height: "44px", border: "1px solid #9A9AAF" }, sx: {
backgroundColor: "#7E2AEA",
color: "white",
width: "237px",
height: "44px",
border: "1px solid #9A9AAF",
},
title: "До формы контактов", title: "До формы контактов",
type: "toContactForm", type: "toContactForm",
}, },
{ {
sx: { backgroundColor: "#F2F3F7", color: "#9A9AAF", width: "266px", height: "44px", border: "1px solid #9A9AAF" }, sx: {
backgroundColor: "#F2F3F7",
color: "#9A9AAF",
width: "266px",
height: "44px",
border: "1px solid #9A9AAF",
},
title: "После формы контактов", title: "После формы контактов",
type: "afterСontactForm", type: "afterСontactForm",
}, },
{ {
sx: { color: "#9A9AAF", backgroundColor: "#F2F3F7", width: "233px", height: "44px", border: "1px solid #9A9AAF" }, sx: {
color: "#9A9AAF",
backgroundColor: "#F2F3F7",
width: "233px",
height: "44px",
border: "1px solid #9A9AAF",
},
title: "Отправить на E-mail", title: "Отправить на E-mail",
type: "e-mail", type: "e-mail",
}, },
@ -29,6 +56,8 @@ const buttonSetting: { title: string; sx: SxProps<Theme>; type: string }[] = [
export const SettingForm = () => { export const SettingForm = () => {
const [activeIndex, setActiveIndex] = useState<number>(0); const [activeIndex, setActiveIndex] = useState<number>(0);
const [typeActive, setTypeActive] = useState<string>("toContactForm"); const [typeActive, setTypeActive] = useState<string>("toContactForm");
const theme = useTheme();
const isSmallMonitor = useMediaQuery(theme.breakpoints.down(1100));
const active = (index: number, type: string) => { const active = (index: number, type: string) => {
setActiveIndex(index); setActiveIndex(index);
@ -36,7 +65,7 @@ export const SettingForm = () => {
}; };
return ( return (
<Box component="section" sx={{ width: "796px" }}> <Box component="section" sx={{ maxWidth: "796px" }}>
<Box sx={{ display: "flex", alignItems: "center", mb: "40px" }}> <Box sx={{ display: "flex", alignItems: "center", mb: "40px" }}>
<Typography sx={{ pr: "10px" }} variant="h5"> <Typography sx={{ pr: "10px" }} variant="h5">
Настройки результатов Настройки результатов
@ -63,7 +92,13 @@ export const SettingForm = () => {
Показывать результат Показывать результат
</Typography> </Typography>
<IconButton> <IconButton>
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg
width="30"
height="30"
viewBox="0 0 30 30"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect width="30" height="30" rx="6" fill="#EEE4FC" /> <rect width="30" height="30" rx="6" fill="#EEE4FC" />
<path <path
d="M22.5 11.25L15 18.75L7.5 11.25" d="M22.5 11.25L15 18.75L7.5 11.25"
@ -75,7 +110,15 @@ export const SettingForm = () => {
</svg> </svg>
</IconButton> </IconButton>
</Box> </Box>
<Box sx={{ display: "flex", justifyContent: "space-between", mb: "20px" }}> <Box
sx={{
display: "flex",
flexDirection: isSmallMonitor ? "column" : "row",
justifyContent: "space-between",
gap: "20px",
mb: "20px",
}}
>
{buttonSetting.map(({ sx, title, type }, index) => ( {buttonSetting.map(({ sx, title, type }, index) => (
<Button <Button
disableRipple disableRipple
@ -85,6 +128,7 @@ export const SettingForm = () => {
...sx, ...sx,
bgcolor: activeIndex === index ? " #7E2AEA" : "#F2F3F7", bgcolor: activeIndex === index ? " #7E2AEA" : "#F2F3F7",
color: activeIndex === index ? " white" : "#9A9AAF", color: activeIndex === index ? " white" : "#9A9AAF",
minWidth: isSmallMonitor ? "300px" : "auto",
}} }}
> >
{title} {title}
@ -92,16 +136,27 @@ export const SettingForm = () => {
))} ))}
</Box> </Box>
{typeActive === "e-mail" ? ( {typeActive === "e-mail" ? (
<SwitchSetting icon={listChecks} text="Показывать несколько результатов" /> <SwitchSetting
icon={listChecks}
text="Показывать несколько результатов"
/>
) : ( ) : (
<> <>
<SwitchSetting icon={listChecks} text="Показывать несколько результатов" /> <SwitchSetting
icon={listChecks}
text="Показывать несколько результатов"
/>
<SwitchSetting icon={ShareNetwork} text="Поделиться результатами" /> <SwitchSetting icon={ShareNetwork} text="Поделиться результатами" />
<SwitchSetting icon={ArrowCounterClockWise} text="Кнопка `Пройти тест заново`" /> <SwitchSetting
icon={ArrowCounterClockWise}
text="Кнопка `Пройти тест заново`"
/>
</> </>
)} )}
</Box> </Box>
<Box sx={{ display: "flex", alignItems: "center", mb: "15px", mt: "15px" }}> <Box
sx={{ display: "flex", alignItems: "center", mb: "15px", mt: "15px" }}
>
<Typography variant="p1" sx={{ color: "#4D4D4D", fontSize: "14px" }}> <Typography variant="p1" sx={{ color: "#4D4D4D", fontSize: "14px" }}>
Создайте результат Создайте результат
</Typography> </Typography>

@ -44,10 +44,7 @@ export default function StepOne() {
onClick={() => { onClick={() => {
let SPageClone = listQuizes[params].config; let SPageClone = listQuizes[params].config;
SPageClone.type = "form"; SPageClone.type = "form";
updateQuizesList(params, { updateQuizesList(params, { config: SPageClone });
config: SPageClone,
step: listQuizes[params].step + 1,
});
}} }}
> >
<CreationCard <CreationCard

@ -26,7 +26,6 @@ import { QUIZ_QUESTION_VARIANT } from "../constants/variant";
import { QUIZ_QUESTION_VARIMG } from "../constants/varimg"; import { QUIZ_QUESTION_VARIMG } from "../constants/varimg";
import { setAutoFreeze } from "immer"; import { setAutoFreeze } from "immer";
setAutoFreeze(false); setAutoFreeze(false);
interface QuestionStore { interface QuestionStore {
@ -63,37 +62,40 @@ export const questionStore = create<QuestionStore>()(
return state; return state;
}, },
merge: (persistedState, currentState) => { merge: (persistedState, currentState) => {
const state = persistedState as QuestionStore; const state = persistedState as QuestionStore;
// replace blob urls with "" // replace blob urls with ""
Object.values(state.listQuestions).forEach(questions => { Object.values(state.listQuestions).forEach((questions) => {
questions.forEach(question => { questions.forEach((question) => {
if (question.type === "page" && question.content.picture.startsWith("blob:")) { if (
question.content.picture = ""; question.type === "page" &&
} question.content.picture.startsWith("blob:")
if (question.type === "images") { ) {
question.content.variants.forEach(variant => { question.content.picture = "";
if (variant.extendedText.startsWith("blob:")) { }
variant.extendedText = ""; if (question.type === "images") {
} question.content.variants.forEach((variant) => {
}); if (variant.extendedText.startsWith("blob:")) {
} variant.extendedText = "";
if (question.type === "varimg") { }
question.content.variants.forEach(variant => { });
if (variant.extendedText.startsWith("blob:")) { }
variant.extendedText = ""; if (question.type === "varimg") {
} question.content.variants.forEach((variant) => {
}); if (variant.extendedText.startsWith("blob:")) {
} variant.extendedText = "";
}); }
}); });
}
});
});
return { return {
...currentState, ...currentState,
...state, ...state,
}; };
}, },
} }
) )
); );
@ -191,13 +193,11 @@ export const createQuestion = (
export const copyQuestion = (quizId: number, copiedQuestionIndex: number) => { export const copyQuestion = (quizId: number, copiedQuestionIndex: number) => {
const listQuestions = { ...questionStore.getState()["listQuestions"] }; const listQuestions = { ...questionStore.getState()["listQuestions"] };
const copiedQuiz = listQuestions[quizId][copiedQuestionIndex] const copiedQuiz = { ...listQuestions[quizId][copiedQuestionIndex] };
copiedQuiz.id = getRandom() listQuestions[quizId].splice(copiedQuestionIndex, 0, {
listQuestions[quizId].splice( ...copiedQuiz,
copiedQuestionIndex, id: getRandom(),
0, });
copiedQuiz
);
questionStore.setState({ listQuestions }); questionStore.setState({ listQuestions });
}; };
@ -238,4 +238,4 @@ function getRandom() {
const min = Math.ceil(1000000); const min = Math.ceil(1000000);
const max = Math.floor(10000000); const max = Math.floor(10000000);
return Math.floor(Math.random() * (max - min)) + min; return Math.floor(Math.random() * (max - min)) + min;
} }

@ -22,7 +22,7 @@ export default function CustomWrapper({ text, sx, result }: Props) {
return ( return (
<Box <Box
sx={{ sx={{
width: "796px", maxWidth: "796px",
overflow: "hidden", overflow: "hidden",
borderRadius: "12px", borderRadius: "12px",

@ -25,7 +25,6 @@ export default function SwitchStepPages({
switch (activeStep) { switch (activeStep) {
case 1: case 1:
if (!quizType) return <StepOne />; if (!quizType) return <StepOne />;
if (quizType === "form") return <></>;
if (!startpage) return <Steptwo />; if (!startpage) return <Steptwo />;
return <StartPageSettings />; return <StartPageSettings />;
case 2: case 2: