From 8592e9e212b0e5194beda6467b963427c3972905 Mon Sep 17 00:00:00 2001 From: IlyaDoronin Date: Fri, 25 Aug 2023 12:30:25 +0300 Subject: [PATCH] fix: upload pictures store --- .../Questions/UploadFile/settingUpload.tsx | 38 +++++++++++++------ .../Questions/UploadFile/switchUpload.tsx | 4 +- src/stores/questions.ts | 2 + 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/pages/Questions/UploadFile/settingUpload.tsx b/src/pages/Questions/UploadFile/settingUpload.tsx index b3b1336b..15245742 100644 --- a/src/pages/Questions/UploadFile/settingUpload.tsx +++ b/src/pages/Questions/UploadFile/settingUpload.tsx @@ -1,15 +1,31 @@ -import {Box, Typography} from "@mui/material"; +import { Box, Typography } from "@mui/material"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; + +import { questionStore, updateQuestionsList } from "@root/questions"; + import InfoIcon from "../../../assets/icons/InfoIcon"; +type SettingsUploadProps = { + totalIndex: number; +}; -export default function SettingsUpload() { - return ( - - Настройки вопроса - - - - - ); -}; \ No newline at end of file +export default function SettingsUpload({ totalIndex }: SettingsUploadProps) { + const { listQuestions } = questionStore(); + + return ( + + Настройки вопроса + { + const clonContent = listQuestions[totalIndex].content; + clonContent.autofill = target.checked; + updateQuestionsList(totalIndex, { content: clonContent }); + }} + /> + + + + ); +} diff --git a/src/pages/Questions/UploadFile/switchUpload.tsx b/src/pages/Questions/UploadFile/switchUpload.tsx index 783feac7..83d19b2c 100644 --- a/src/pages/Questions/UploadFile/switchUpload.tsx +++ b/src/pages/Questions/UploadFile/switchUpload.tsx @@ -14,13 +14,13 @@ export default function SwitchUpload({ }: Props) { switch (switchState) { case "setting": - return ; + return ; break; case "help": return ; break; case "branching": - return ; + return ; break; default: return <>; diff --git a/src/stores/questions.ts b/src/stores/questions.ts index 2473f36d..c07f095d 100644 --- a/src/stores/questions.ts +++ b/src/stores/questions.ts @@ -42,6 +42,7 @@ export interface Question { back: string; placeholder: string; type: string; + autofill: boolean; }; version: number; parent_ids: number[]; @@ -106,6 +107,7 @@ export const createQuestion = (id: number) => { back: "", placeholder: "", type: "single", + autofill: true, variants: [ { answer: "",