diff --git a/src/pages/Questions/ButtonsOptionsAndPict.tsx b/src/pages/Questions/ButtonsOptionsAndPict.tsx index 629283d3..6746f564 100644 --- a/src/pages/Questions/ButtonsOptionsAndPict.tsx +++ b/src/pages/Questions/ButtonsOptionsAndPict.tsx @@ -19,9 +19,11 @@ interface Props { export default function ButtonsOptionsAndPict({ SSHC, switchState, totalIndex }: Props) { const params = Number(useParams().quizId); - const {listQuestions, updateQuestionsList, createQuestion, removeQuestion, openedModalSettings} = questionStore() + const {listQuestions, updateQuestionsList, createQuestion, removeQuestion, openedModalSettings, createOpenedModalSettings} = questionStore() + const idQuestions = listQuestions[params].id const openedModal = () => { - + createOpenedModalSettings({openedModalSettings: "открыто"}) + console.log(openedModalSettings) } const theme = useTheme(); return ( @@ -67,6 +69,7 @@ export default function ButtonsOptionsAndPict({ SSHC, switchState, totalIndex }: { SSHC("branching"); + openedModal() }} sx={{ backgroundColor: switchState === "branching" ? theme.palette.brightPurple.main : "transparent", @@ -79,6 +82,7 @@ export default function ButtonsOptionsAndPict({ SSHC, switchState, totalIndex }: { SSHC("image"); + }} sx={{ backgroundColor: switchState === "image" ? theme.palette.brightPurple.main : "transparent", diff --git a/src/pages/Questions/branchingQuestions.tsx b/src/pages/Questions/branchingQuestions.tsx index f672cb2f..9585983e 100644 --- a/src/pages/Questions/branchingQuestions.tsx +++ b/src/pages/Questions/branchingQuestions.tsx @@ -24,10 +24,10 @@ import RadioIcon from "@ui_kit/RadioIcon"; export default function BranchingQuestions() { const theme = useTheme(); - // const [open, setOpen] = useState(false); + const [open, setOpen] = useState(false); const [condition, setCondition] = useState(false); - // const handleOpen = () => setOpen(true); - // const handleClose = () => setOpen(false); + const handleOpen = () => setOpen(true); + const handleClose = () => setOpen(false); const [display, setDisplay] = React.useState("1"); const handleChange = (event: SelectChangeEvent) => { @@ -42,8 +42,8 @@ export default function BranchingQuestions() { return ( <> @@ -259,7 +259,7 @@ export default function BranchingQuestions() { diff --git a/src/stores/questions.ts b/src/stores/questions.ts index 7e9b821e..89034003 100644 --- a/src/stores/questions.ts +++ b/src/stores/questions.ts @@ -7,6 +7,7 @@ interface QuestionStore { removeQuestion: any; createQuestion: (id: number) => void; openedModalSettings: any + createOpenedModalSettings: (data: any) => void; } export const questionStore = create()( @@ -70,12 +71,12 @@ export const questionStore = create()( set({listQuestions: state}); }, - openedModalSettings: [], + openedModalSettings: "", - createOpenedModalSettings: (id: number) => { - const state = get()["openedModalSettings"] || []; - state.push(String(id)) - set({openedModalSettings: state}) + createOpenedModalSettings: (data:any) => { + const oldState = get() + const newStore = {...oldState, ...data} + set(newStore) } }),