diff --git a/src/assets/icons/CrossedEyeIcon.tsx b/src/assets/icons/CrossedEyeIcon.tsx
index 2c7fbf6b..f2db60c7 100644
--- a/src/assets/icons/CrossedEyeIcon.tsx
+++ b/src/assets/icons/CrossedEyeIcon.tsx
@@ -5,37 +5,37 @@ export default function CrossedEyeIcon() {
);
diff --git a/src/assets/icons/questionsPage/hideIcon.tsx b/src/assets/icons/questionsPage/hideIcon.tsx
index a8f1cfba..7d1fe189 100755
--- a/src/assets/icons/questionsPage/hideIcon.tsx
+++ b/src/assets/icons/questionsPage/hideIcon.tsx
@@ -18,9 +18,9 @@ export default function HideIcon() {
}}
>
);
diff --git a/src/pages/Questions/QuestionPageCard.tsx b/src/pages/Questions/QuestionPageCard.tsx
index e9478e54..4ea15ba0 100644
--- a/src/pages/Questions/QuestionPageCard.tsx
+++ b/src/pages/Questions/QuestionPageCard.tsx
@@ -1,4 +1,4 @@
-import {Box, IconButton, Paper} from "@mui/material";
+import {Box, Checkbox, FormControlLabel, IconButton, Paper, useTheme} from "@mui/material";
import CustomTextField from "@ui_kit/CustomTextField";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
@@ -10,20 +10,25 @@ import React, {useState} from "react";
import DeleteIcon from "@icons/questionsPage/deleteIcon";
import {useParams} from "react-router-dom";
import {questionStore} from "@root/questions";
+import CustomCheckbox from "@ui_kit/CustomCheckbox";
+import CopyIcon from "@icons/questionsPage/CopyIcon";
+import CrossedEyeIcon from "@icons/CrossedEyeIcon";
+import EyeIcon from "@icons/EyeIcon";
+import HideIcon from "@icons/questionsPage/hideIcon";
interface Props {
- switchState: string;
- SSHC: (data: string) => void;
DeleteClick: () => void;
totalIndex: number
}
-export default function QuestionsPageCard({ SSHC, switchState, totalIndex }: Props) {
+export default function QuestionsPageCard({totalIndex, DeleteClick}: Props) {
+ const theme = useTheme();
const params = Number(useParams().quizId);
const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore()
const [isExpanded, setIsExpanded] = useState(false);
+ const switchState = listQuestions[params][totalIndex].type
return (
-
+
@@ -39,18 +44,37 @@ export default function QuestionsPageCard({ SSHC, switchState, totalIndex }: Pro
:
}
+
+ }
+ checkedIcon={}
+ />}
+ label={""}
+ sx={{
+ color: theme.palette.grey2.main,
+ ml: "-9px",
+ mr: 0,
+ userSelect: "none",
+ }}
+
+ />
+
+
+
+
+
-
-
-
+
{isExpanded && (
{switchState.length === 0 ?
-
+
:
- }
+ }
)
}
diff --git a/src/pages/Questions/QuestionsPage.tsx b/src/pages/Questions/QuestionsPage.tsx
index 0aa24e2b..b905711f 100755
--- a/src/pages/Questions/QuestionsPage.tsx
+++ b/src/pages/Questions/QuestionsPage.tsx
@@ -23,11 +23,10 @@ export default function QuestionsPage() {
let result = listQuizes[params].step - 1
updateQuizesList(params, {step: result ? result : 1})
};
-
- const [switchState, setSwitchState] = React.useState('');
- const SSHC = (data: string) => {
- setSwitchState(data)
- }
+ // const [switchState, setSwitchState] = React.useState('');
+ // const SSHC = (data: string) => {
+ // setSwitchState(data)
+ // }
const theme = useTheme();
return (
@@ -44,7 +43,7 @@ export default function QuestionsPage() {
{Object.values(listQuestions[params]).map((e, index) => (
- removeQuestion(params,index)}/>
+ removeQuestion(params,index)}/>
)
)}
diff --git a/src/pages/Questions/SwitchQuestionsPage.tsx b/src/pages/Questions/SwitchQuestionsPage.tsx
index c2462292..8fc446a2 100644
--- a/src/pages/Questions/SwitchQuestionsPage.tsx
+++ b/src/pages/Questions/SwitchQuestionsPage.tsx
@@ -11,14 +11,17 @@ import RatingOptions from "./RatingOptions/RatingOptions";
import Emoji from "./Emoji/Emoji";
import DropDown from "./DropDown/DropDown";
import UploadFile from "./UploadFile/UploadFile";
+import {useParams} from "react-router-dom";
+import {questionStore} from "@root/questions";
interface Props {
- switchState: string,
- // DeleteClick: () => void;
totalIndex: number,
}
-export default function SwitchQuestionsPage ({switchState = '', totalIndex }: Props) {
+export default function SwitchQuestionsPage ({totalIndex }: Props) {
+ const params = Number(useParams().quizId);
+ const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore()
+ const switchState = listQuestions[params][totalIndex].type
switch (switchState) {
case 'answer':
return ();
diff --git a/src/pages/Questions/TypeQuestions.tsx b/src/pages/Questions/TypeQuestions.tsx
index 3c95ae72..b0c443de 100755
--- a/src/pages/Questions/TypeQuestions.tsx
+++ b/src/pages/Questions/TypeQuestions.tsx
@@ -12,28 +12,32 @@ import Page from "../../assets/icons/questionsPage/page";
import RatingIcon from "../../assets/icons/questionsPage/rating";
import {Box} from "@mui/material";
import React from "react";
+import {useParams} from "react-router-dom";
+import {questionStore} from "@root/questions";
interface Props {
- switchState: string;
- SSHC: (data: string) => void;
+ totalIndex: number
}
-export default function TypeQuestions({ SSHC, switchState }: Props) {
+export default function TypeQuestions({totalIndex }: Props) {
+ const params = Number(useParams().quizId);
+ const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore()
+ const switchState = listQuestions[params][totalIndex].type
const buttonTypeQuestions: { icon: JSX.Element; title: string; value: string }[] = [
{
icon: ,
title: 'Варианты ответов',
- value: 'answer',
+ value: 'variant',
},
{
icon: ,
title: 'Варианты с картинками',
- value: 'answerpict',
+ value: 'images',
},
{
icon: ,
title: 'Варианты и картинка',
- value: 'answerandpict',
+ value: 'varimg',
},
{
icon: ,
@@ -43,12 +47,12 @@ export default function TypeQuestions({ SSHC, switchState }: Props) {
{
icon: ,
title: 'Своё поле для ввода',
- value: 'textfield',
+ value: 'text',
},
{
icon: ,
title: 'Выпадающий список',
- value: 'dropdown',
+ value: 'select',
},
{
icon: ,
@@ -58,12 +62,12 @@ export default function TypeQuestions({ SSHC, switchState }: Props) {
{
icon: ,
title: 'Ползунок',
- value: 'slider',
+ value: 'number',
},
{
icon: ,
title: 'Загрузка файла',
- value: 'uploader',
+ value: 'file',
},
{
icon: ,
@@ -83,8 +87,8 @@ export default function TypeQuestions({ SSHC, switchState }: Props) {
{
- SSHC(value);
console.log(value)
+ updateQuestionsList(params, totalIndex, {type: value})
}}
icon={icon}
text={title}
diff --git a/src/stores/questions.ts b/src/stores/questions.ts
index 4759301c..aa35d683 100644
--- a/src/stores/questions.ts
+++ b/src/stores/questions.ts
@@ -15,23 +15,6 @@ export const questionStore = create()(
persist(
(set, get) => ({
listQuestions: {
- // 1871018: [
- // {
- // "title": "",
- // "description": "",
- // "type": "",
- // "required": true,
- // "deleted": true,
- // "page": 0,
- // "content": "",
- // "version": 0,
- // "parent_ids": [
- // 0
- // ],
- // "created_at": "",
- // "updated_at": ""
- // },
- // ]
},
updateQuestionsList: (id: number, index: number, values: any) => {
const array = get()["listQuestions"][id] || [];