fix: bugs
This commit is contained in:
parent
9a2288adae
commit
96c58dfd18
@ -1,23 +1,31 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { Box, Typography } from "@mui/material";
|
||||
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
||||
import InfoIcon from "../../../assets/icons/InfoIcon";
|
||||
import * as React from "react";
|
||||
import CustomTextField from "@ui_kit/CustomTextField";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { questionStore, updateQuestionsList } from "@root/questions";
|
||||
|
||||
import type { ChangeEvent } from "react";
|
||||
|
||||
interface Props {
|
||||
totalIndex: number;
|
||||
}
|
||||
|
||||
export default function ResponseSettings({ totalIndex }: Props) {
|
||||
const params = Number(useParams().quizId);
|
||||
const [checked, setChecked] = useState(false);
|
||||
const { listQuestions } = questionStore();
|
||||
const [checked, setChecked] = React.useState([true, false]);
|
||||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setChecked([checked[0], event.target.checked]);
|
||||
|
||||
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
|
||||
setChecked(event.target.checked);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (listQuestions[totalIndex].content.innerName.length) {
|
||||
setChecked(true);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex" }}>
|
||||
<Box sx={{ padding: "20px", display: "flex", flexDirection: "column" }}>
|
||||
@ -62,18 +70,18 @@ export default function ResponseSettings({ totalIndex }: Props) {
|
||||
<Box sx={{ display: "flex" }}>
|
||||
<CustomCheckbox
|
||||
label={"Внутреннее название вопроса"}
|
||||
checked={checked[1]}
|
||||
checked={checked}
|
||||
handleChange={handleChange}
|
||||
/>{" "}
|
||||
<InfoIcon />
|
||||
</Box>
|
||||
{checked[1] && (
|
||||
{checked && (
|
||||
<CustomTextField
|
||||
placeholder={"Развёрнутое описание вопроса"}
|
||||
text={listQuestions[totalIndex].description}
|
||||
onChange={(e) => {
|
||||
text={listQuestions[totalIndex].content.innerName}
|
||||
onChange={({ target }) => {
|
||||
let clonContent = listQuestions[totalIndex].content;
|
||||
clonContent.innerName = e.target.value;
|
||||
clonContent.innerName = target.value;
|
||||
updateQuestionsList(totalIndex, { content: clonContent });
|
||||
}}
|
||||
/>
|
||||
|
@ -165,7 +165,7 @@ export default function BranchingQuestions({
|
||||
</Box>
|
||||
<Select
|
||||
empty
|
||||
activeItemIndex={Number(request.id) || -1}
|
||||
activeItemIndex={request.id ? Number(request.id) : -1}
|
||||
items={STIPULATIONS}
|
||||
onChange={(stipulation) => {
|
||||
const clonContent = listQuestions[totalIndex].content;
|
||||
|
Loading…
Reference in New Issue
Block a user