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