diff --git a/src/pages/Questions/ButtonsOptionsAndPict.tsx b/src/pages/Questions/ButtonsOptionsAndPict.tsx index b192ac9b..629283d3 100644 --- a/src/pages/Questions/ButtonsOptionsAndPict.tsx +++ b/src/pages/Questions/ButtonsOptionsAndPict.tsx @@ -19,7 +19,10 @@ interface Props { export default function ButtonsOptionsAndPict({ SSHC, switchState, totalIndex }: Props) { const params = Number(useParams().quizId); - const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore() + const {listQuestions, updateQuestionsList, createQuestion, removeQuestion, openedModalSettings} = questionStore() + const openedModal = () => { + + } const theme = useTheme(); return ( { setSwitchState(data) } - + // const [openBranch, setOpenBranch] = useState(false); + // const handleOpenBranch = () => setOpenBranch(true); + // const handleCloseBranch = () => setOpenBranch(false); const [anchorEl, setAnchorEl] = React.useState(null); @@ -66,12 +68,12 @@ export default function AnswerOptions({totalIndex}: Props) { sx={{ p: "0 0 20px 0" }} > { const answerNew = Answer - answerNew[index] = e.target.value + answerNew[index].answer = e.target.value let clonContent = listQuestions[params][totalIndex].content clonContent.variants = answerNew updateQuestionsList(params, totalIndex, {content: clonContent})}} @@ -96,7 +98,14 @@ export default function AnswerOptions({totalIndex}: Props) { horizontal: 'left', }} > - + { + const answerNew = Answer + answerNew[index].hints = e.target.value + let clonContent = listQuestions[params][totalIndex].content + clonContent.variants = answerNew + updateQuestionsList(params, totalIndex, {content: clonContent})}} + /> { @@ -142,7 +151,7 @@ export default function AnswerOptions({totalIndex}: Props) { sx={{color: theme.palette.brightPurple.main}} onClick={() => { const answerNew = Answer - answerNew.push("") + answerNew.push({answer: "",}) let clonContent = listQuestions[params][totalIndex].content clonContent.variants = answerNew updateQuestionsList(params, totalIndex, {content: clonContent}) diff --git a/src/pages/Questions/branchingQuestions.tsx b/src/pages/Questions/branchingQuestions.tsx index 7c1a29eb..f672cb2f 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) => { @@ -41,10 +41,9 @@ export default function BranchingQuestions() { }; return ( <> - @@ -260,7 +259,7 @@ export default function BranchingQuestions() { diff --git a/src/stores/questions.ts b/src/stores/questions.ts index 092c5801..7e9b821e 100644 --- a/src/stores/questions.ts +++ b/src/stores/questions.ts @@ -6,6 +6,7 @@ interface QuestionStore { updateQuestionsList: (id: number, index: number, values: unknown) => void; removeQuestion: any; createQuestion: (id: number) => void; + openedModalSettings: any } export const questionStore = create()( @@ -39,7 +40,11 @@ export const questionStore = create()( "page": 0, "content": { variants: [ - + { + answer: "", + answerLong: "", + hints: "" + } ], own: true, multi: true @@ -64,6 +69,14 @@ export const questionStore = create()( state[id] = array set({listQuestions: state}); }, + + openedModalSettings: [], + + createOpenedModalSettings: (id: number) => { + const state = get()["openedModalSettings"] || []; + state.push(String(id)) + set({openedModalSettings: state}) + } }), {