функция для добавления в стор вопросов состояния модалки
This commit is contained in:
parent
16468c601f
commit
5705e9aa42
@ -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 }:
|
||||
<MiniButtonSetting
|
||||
onClick={() => {
|
||||
SSHC("branching");
|
||||
openedModal()
|
||||
}}
|
||||
sx={{
|
||||
backgroundColor: switchState === "branching" ? theme.palette.brightPurple.main : "transparent",
|
||||
@ -79,6 +82,7 @@ export default function ButtonsOptionsAndPict({ SSHC, switchState, totalIndex }:
|
||||
<MiniButtonSetting
|
||||
onClick={() => {
|
||||
SSHC("image");
|
||||
|
||||
}}
|
||||
sx={{
|
||||
backgroundColor: switchState === "image" ? theme.palette.brightPurple.main : "transparent",
|
||||
|
@ -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<boolean>(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 (
|
||||
<>
|
||||
<Modal
|
||||
open={openBranch}
|
||||
onClose={handleCloseBranch}
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
aria-labelledby="modal-modal-title"
|
||||
aria-describedby="modal-modal-description"
|
||||
>
|
||||
@ -259,7 +259,7 @@ export default function BranchingQuestions() {
|
||||
<Box sx={{ display: "flex", justifyContent: "end", gap: "10px" }}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={handleCloseBranch}
|
||||
onClick={handleClose}
|
||||
>
|
||||
Отмена
|
||||
</Button>
|
||||
|
@ -7,6 +7,7 @@ interface QuestionStore {
|
||||
removeQuestion: any;
|
||||
createQuestion: (id: number) => void;
|
||||
openedModalSettings: any
|
||||
createOpenedModalSettings: (data: any) => void;
|
||||
}
|
||||
|
||||
export const questionStore = create<QuestionStore>()(
|
||||
@ -70,12 +71,12 @@ export const questionStore = create<QuestionStore>()(
|
||||
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)
|
||||
}
|
||||
}),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user