2023-12-31 02:53:25 +00:00
|
|
|
|
import {
|
|
|
|
|
Box,
|
2024-02-26 14:32:32 +00:00
|
|
|
|
Divider,
|
2023-12-31 02:53:25 +00:00
|
|
|
|
Paper,
|
|
|
|
|
Typography,
|
|
|
|
|
useMediaQuery,
|
|
|
|
|
useTheme,
|
|
|
|
|
} from "@mui/material";
|
|
|
|
|
import { updateQuiz } from "@root/quizes/actions";
|
|
|
|
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
2024-04-17 14:14:14 +00:00
|
|
|
|
import type { DesignItem } from "./DesignGroup";
|
2024-02-26 14:32:32 +00:00
|
|
|
|
import { DesignGroup } from "./DesignGroup";
|
2023-12-30 00:29:13 +00:00
|
|
|
|
|
2024-04-17 14:14:14 +00:00
|
|
|
|
import Desgin1 from "@icons/designs/smallSize/design1.jpg";
|
|
|
|
|
import Desgin2 from "@icons/designs/smallSize/design2.jpg";
|
|
|
|
|
import Desgin3 from "@icons/designs/smallSize/design3.jpg";
|
|
|
|
|
import Desgin4 from "@icons/designs/smallSize/design4.jpg";
|
|
|
|
|
import Desgin5 from "@icons/designs/smallSize/design5.jpg";
|
|
|
|
|
import Desgin6 from "@icons/designs/smallSize/design6.jpg";
|
|
|
|
|
import Desgin7 from "@icons/designs/smallSize/design7.jpg";
|
|
|
|
|
import Desgin8 from "@icons/designs/smallSize/design8.jpg";
|
|
|
|
|
import Desgin9 from "@icons/designs/smallSize/design9.jpg";
|
|
|
|
|
import Desgin10 from "@icons/designs/smallSize/design10.jpg";
|
2024-02-26 14:32:32 +00:00
|
|
|
|
|
2024-03-04 16:31:11 +00:00
|
|
|
|
const LIGHT_THEME_BUTTONS: DesignItem[] = [
|
2024-02-26 14:32:32 +00:00
|
|
|
|
{
|
|
|
|
|
label: "Стандартный",
|
|
|
|
|
name: "StandardTheme",
|
|
|
|
|
colors: ["#7E2AEA", "#333647", ""],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Черно-белый",
|
|
|
|
|
name: "BlackWhiteTheme",
|
|
|
|
|
colors: ["#4E4D51", "#333647", ""],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Оливковый",
|
|
|
|
|
name: "OliveTheme",
|
|
|
|
|
colors: ["#758E4F", "#333647", ""],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Фиолетовый",
|
|
|
|
|
name: "PurpleTheme",
|
|
|
|
|
colors: ["#7E2AEA", "#333647", ""],
|
|
|
|
|
},
|
|
|
|
|
{ label: "Желтый", name: "YellowTheme", colors: ["#F2B133", "#333647", ""] },
|
|
|
|
|
{ label: "Голубой", name: "BlueTheme", colors: ["#4964ED", "#333647", ""] },
|
|
|
|
|
{ label: "Розовый", name: "PinkTheme", colors: ["#D34085", "#333647", ""] },
|
|
|
|
|
];
|
|
|
|
|
|
2024-03-04 16:31:11 +00:00
|
|
|
|
const DARK_THEME_BUTTONS: DesignItem[] = [
|
2024-02-26 14:32:32 +00:00
|
|
|
|
{
|
|
|
|
|
label: "Стандартный",
|
|
|
|
|
name: "StandardDarkTheme",
|
|
|
|
|
colors: ["#7E2AEA", "", "#333647"],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Золотой",
|
|
|
|
|
name: "GoldDarkTheme",
|
|
|
|
|
colors: ["#E6AA37", "", "#333647"],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Розовый",
|
|
|
|
|
name: "PinkDarkTheme",
|
|
|
|
|
colors: ["#D34085", "", "#333647"],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Бирюзовый",
|
|
|
|
|
name: "BlueDarkTheme",
|
|
|
|
|
colors: ["#07A0C3", "", "#333647"],
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2024-03-04 16:31:11 +00:00
|
|
|
|
const DESIGNG_LIST_FIRST: DesignItem[] = [
|
|
|
|
|
{ label: "Дизайн 1", name: "Design1", picture: Desgin1 },
|
|
|
|
|
{ label: "Дизайн 2", name: "Design2", picture: Desgin2 },
|
|
|
|
|
{ label: "Дизайн 3", name: "Design3", picture: Desgin3 },
|
|
|
|
|
{ label: "Дизайн 4", name: "Design4", picture: Desgin4 },
|
|
|
|
|
{ label: "Дизайн 5", name: "Design5", picture: Desgin5 },
|
2024-01-02 09:38:31 +00:00
|
|
|
|
];
|
2024-03-04 16:31:11 +00:00
|
|
|
|
const DESIGNG_LIST_SECOND: DesignItem[] = [
|
|
|
|
|
{ label: "Дизайн 6", name: "Design6", picture: Desgin6 },
|
|
|
|
|
{ label: "Дизайн 7", name: "Design7", picture: Desgin7 },
|
|
|
|
|
{ label: "Дизайн 8", name: "Design8", picture: Desgin8 },
|
|
|
|
|
{ label: "Дизайн 9", name: "Design9", picture: Desgin9 },
|
|
|
|
|
{ label: "Дизайн 10", name: "Design10", picture: Desgin10 },
|
2024-01-02 09:38:31 +00:00
|
|
|
|
];
|
2024-02-15 01:19:03 +00:00
|
|
|
|
|
2024-02-26 14:32:32 +00:00
|
|
|
|
interface DesignFillingProps {
|
2024-02-15 01:19:03 +00:00
|
|
|
|
mobileSidebar: boolean;
|
|
|
|
|
heightSidebar: number;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-26 14:32:32 +00:00
|
|
|
|
export const DesignFilling = ({
|
|
|
|
|
mobileSidebar,
|
|
|
|
|
heightSidebar,
|
|
|
|
|
}: DesignFillingProps) => {
|
2024-01-02 01:31:47 +00:00
|
|
|
|
const quiz = useCurrentQuiz();
|
|
|
|
|
const theme = useTheme();
|
|
|
|
|
const isMobile = useMediaQuery(theme.breakpoints.down(830));
|
2024-02-15 01:19:03 +00:00
|
|
|
|
const heightBar = heightSidebar + 51 + 88 + 36;
|
2024-02-26 14:32:32 +00:00
|
|
|
|
|
2023-12-31 02:53:25 +00:00
|
|
|
|
return (
|
2024-02-14 02:24:25 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
width: "100%",
|
2024-03-14 09:40:44 +00:00
|
|
|
|
padding: isMobile
|
2024-02-14 02:24:25 +00:00
|
|
|
|
? mobileSidebar
|
2024-03-14 09:40:44 +00:00
|
|
|
|
? `calc(${heightBar}px - 92px) 16px 70px 16px`
|
|
|
|
|
: "67px 16px 70px 16px"
|
|
|
|
|
: "25px",
|
|
|
|
|
height: isMobile ? "100vh" : "calc(100vh - 80px)",
|
2024-02-14 02:24:25 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2023-12-31 02:53:25 +00:00
|
|
|
|
<Typography variant="h5" sx={{ marginBottom: "40px", color: "#333647" }}>
|
|
|
|
|
Дизайн
|
|
|
|
|
</Typography>
|
|
|
|
|
<Paper
|
|
|
|
|
sx={{
|
2024-03-18 14:24:43 +00:00
|
|
|
|
padding: "5px",
|
2023-12-31 02:53:25 +00:00
|
|
|
|
maxWidth: "796px",
|
|
|
|
|
width: "100%",
|
|
|
|
|
borderRadius: "12px",
|
2024-03-14 09:40:44 +00:00
|
|
|
|
height: "calc(100vh - 300px)",
|
2024-05-07 22:27:57 +00:00
|
|
|
|
mb: "76px"
|
2023-12-31 02:53:25 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-03-18 14:24:43 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
padding: "20px",
|
|
|
|
|
height: "100%",
|
|
|
|
|
overflow: "auto",
|
|
|
|
|
scrollbarWidth: "auto",
|
|
|
|
|
"&::-webkit-scrollbar": {
|
|
|
|
|
display: "block",
|
|
|
|
|
width: "8px",
|
|
|
|
|
},
|
|
|
|
|
"&::-webkit-scrollbar-thumb": {
|
|
|
|
|
backgroundColor: theme.palette.brightPurple.main,
|
|
|
|
|
borderRadius: "4px",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box sx={{ display: "flex", gap: "20px", flexWrap: "wrap" }}>
|
|
|
|
|
<DesignGroup
|
|
|
|
|
title="Со светлым фоном"
|
|
|
|
|
value={quiz?.config.design ? "" : quiz?.config.theme || ""}
|
|
|
|
|
list={LIGHT_THEME_BUTTONS}
|
|
|
|
|
onChange={(name) =>
|
|
|
|
|
updateQuiz(quiz?.id, (quiz) => {
|
|
|
|
|
quiz.config.design = false;
|
|
|
|
|
quiz.config.theme = name;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<DesignGroup
|
|
|
|
|
title="С тёмным фоном"
|
|
|
|
|
value={quiz?.config.design ? "" : quiz?.config.theme || ""}
|
|
|
|
|
list={DARK_THEME_BUTTONS}
|
|
|
|
|
onChange={(name) =>
|
|
|
|
|
updateQuiz(quiz?.id, (quiz) => {
|
|
|
|
|
quiz.config.design = false;
|
|
|
|
|
quiz.config.theme = name;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
|
|
|
|
<Box>
|
|
|
|
|
<Divider sx={{ margin: "20px 0", background: "#7E2AEA33" }} />
|
|
|
|
|
</Box>
|
|
|
|
|
<Box sx={{ display: "flex", gap: "20px", flexWrap: "wrap" }}>
|
|
|
|
|
<DesignGroup
|
|
|
|
|
title="С картинкой"
|
|
|
|
|
value={quiz?.config.theme || ""}
|
|
|
|
|
list={DESIGNG_LIST_FIRST}
|
|
|
|
|
onChange={(name) =>
|
|
|
|
|
updateQuiz(quiz?.id, (quiz) => {
|
|
|
|
|
quiz.config.design = true;
|
|
|
|
|
quiz.config.theme = name;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<DesignGroup
|
|
|
|
|
value={quiz?.config.theme || ""}
|
|
|
|
|
list={DESIGNG_LIST_SECOND}
|
|
|
|
|
onChange={(name) =>
|
|
|
|
|
updateQuiz(quiz?.id, (quiz) => {
|
|
|
|
|
quiz.config.design = true;
|
|
|
|
|
quiz.config.theme = name;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
2023-12-30 00:29:13 +00:00
|
|
|
|
</Box>
|
2023-12-31 02:53:25 +00:00
|
|
|
|
</Paper>
|
|
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
};
|