открытие модалки ветвления с помощью стора

This commit is contained in:
Tamara 2023-07-14 21:29:09 +03:00
parent a38ea6987a
commit 3b4c5aaafb
6 changed files with 22 additions and 32 deletions

@ -18,9 +18,13 @@ interface Props {
export default function ButtonsOptions({ SSHC, switchState, totalIndex }: Props) {
const params = Number(useParams().quizId);
const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore()
const {listQuestions, updateQuestionsList, createQuestion, removeQuestion, openedModalSettings, createOpenedModalSettings} = questionStore()
const openedModal = () => {
createOpenedModalSettings({openedModalSettings: "open"})
console.log(openedModalSettings)
}
const theme = useTheme();
const buttonSetting: { icon: JSX.Element; title: string; value: string }[] = [
const buttonSetting: { icon: JSX.Element; title: string; value: string; myFunc?: any }[] = [
{
icon: <SettingIcon color={switchState === "setting" ? "#ffffff" : theme.palette.grey3.main} />,
title: "Настройки",
@ -35,6 +39,7 @@ export default function ButtonsOptions({ SSHC, switchState, totalIndex }: Props)
icon: <Branching color={switchState === "branching" ? "#ffffff" : theme.palette.grey3.main} />,
title: "Ветвление",
value: "branching",
myFunc: openedModal
},
];
@ -54,11 +59,12 @@ export default function ButtonsOptions({ SSHC, switchState, totalIndex }: Props)
gap: "10px",
}}
>
{buttonSetting.map(({ icon, title, value }) => (
{buttonSetting.map(({ icon, title, value, myFunc}) => (
<MiniButtonSetting
key={title}
onClick={() => {
SSHC(value);
{myFunc()}
}}
sx={{
backgroundColor: switchState === value ? theme.palette.brightPurple.main : "transparent",

@ -20,9 +20,8 @@ interface Props {
export default function ButtonsOptionsAndPict({ SSHC, switchState, totalIndex }: Props) {
const params = Number(useParams().quizId);
const {listQuestions, updateQuestionsList, createQuestion, removeQuestion, openedModalSettings, createOpenedModalSettings} = questionStore()
const idQuestions = listQuestions[params].id
const openedModal = () => {
createOpenedModalSettings({openedModalSettings: "открыто"})
createOpenedModalSettings({openedModalSettings: "open"})
console.log(openedModalSettings)
}
const theme = useTheme();

@ -21,14 +21,18 @@ import { useState } from "react";
import DeleteIcon from "@icons/questionsPage/deleteIcon";
import RadioCheck from "@ui_kit/RadioCheck";
import RadioIcon from "@ui_kit/RadioIcon";
import {questionStore} from "@root/questions";
export default function BranchingQuestions() {
const theme = useTheme();
const [open, setOpen] = useState(false);
const [condition, setCondition] = useState<boolean>(false);
const handleOpen = () => setOpen(true);
const handleClose = () => setOpen(false);
const {listQuestions, updateQuestionsList, createQuestion, removeQuestion, openedModalSettings, createOpenedModalSettings} = questionStore()
const theme = useTheme();
const [condition, setCondition] = useState<boolean>(false);
const handleClose = () => {
createOpenedModalSettings({openedModalSettings: ""})
console.log(openedModalSettings)
}
const [display, setDisplay] = React.useState("1");
const handleChange = (event: SelectChangeEvent) => {
setDisplay(event.target.value);
@ -42,7 +46,7 @@ export default function BranchingQuestions() {
return (
<>
<Modal
open={open}
open={Boolean(openedModalSettings)}
onClose={handleClose}
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"

@ -115,12 +115,6 @@ export default function StartPageSettings({ handleNext }: HandleNext) {
return (
<>
<DropFav
text="a"
sx={{}}
heightImg="100"
widthImg="200"
/>
<Typography variant="h5" sx={{marginTop: "60px"}}>Стартовая страница</Typography>
<Box sx={{
backgroundColor: "white",
@ -384,7 +378,7 @@ export default function StartPageSettings({ handleNext }: HandleNext) {
alignItems: "end",
gap: "10px",
}}>
<DropZone sx={{height: "48px", width: "48px"}} heightImg={"48px"} widthImg={"48px"}/>
<DropFav sx={{height: "48px", width: "48px"}} heightImg={"48px"} widthImg={"48px"}/>
<Typography sx={{
color: theme.palette.orange.main,
@ -393,7 +387,7 @@ export default function StartPageSettings({ handleNext }: HandleNext) {
textDecoration: "underline",
}}>5 MB максимум</Typography>
</Box>
{/*<DropFav heightImg={"200px"}/>*/}
</Box>
{/*Правая сторона*/}
<Box sx={{

@ -20,9 +20,6 @@ const imageFavicon = [
compressFormat: "PNG",
quality: 100,
rotation: 0,
// outputType: "string",
// minWidth: 16,
// minHeight: 16,
},
{
maxWidth: 32,
@ -30,9 +27,6 @@ const imageFavicon = [
compressFormat: "PNG",
quality: 100,
rotation: 0,
// outputType: "string",
// minWidth: 32,
// minHeight: 32,
},
{
maxWidth: 48,
@ -40,9 +34,6 @@ const imageFavicon = [
compressFormat: "PNG",
quality: 100,
rotation: 0,
// outputType: "string",
// minWidth: 48,
// minHeight: 48,
},
{
maxWidth: 76,

@ -70,12 +70,8 @@ export const questionStore = create<QuestionStore>()(
state[id] = array
set({listQuestions: state});
},
<<<<<<< HEAD
openedModalSettings: "",
=======
openedModalSettings: [],
>>>>>>> 12f9f82 (images from favicon)
createOpenedModalSettings: (data:any) => {
const oldState = get()