fix: upload pictures store

This commit is contained in:
IlyaDoronin 2023-08-25 12:30:25 +03:00
parent 51c11eac35
commit 8592e9e212
3 changed files with 31 additions and 13 deletions

@ -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 (
<Box sx={{display: 'flex', flexDirection: 'column', padding: '20px'}}>
<Typography>Настройки вопроса</Typography>
<CustomCheckbox label={'Автозаполнение адреса'}/>
<CustomCheckbox label={'Необязательный вопрос'}/>
<CustomCheckbox label={'Внутреннее название вопроса'}/> <InfoIcon />
</Box>
);
};
export default function SettingsUpload({ totalIndex }: SettingsUploadProps) {
const { listQuestions } = questionStore();
return (
<Box sx={{ display: "flex", flexDirection: "column", padding: "20px" }}>
<Typography>Настройки вопроса</Typography>
<CustomCheckbox
label={"Автозаполнение адреса"}
checked={listQuestions[totalIndex].content.autofill}
handleChange={({ target }) => {
const clonContent = listQuestions[totalIndex].content;
clonContent.autofill = target.checked;
updateQuestionsList(totalIndex, { content: clonContent });
}}
/>
<CustomCheckbox label={"Необязательный вопрос"} />
<CustomCheckbox label={"Внутреннее название вопроса"} /> <InfoIcon />
</Box>
);
}

@ -14,13 +14,13 @@ export default function SwitchUpload({
}: Props) {
switch (switchState) {
case "setting":
return <SettingsUpload />;
return <SettingsUpload totalIndex={totalIndex} />;
break;
case "help":
return <HelpQuestions totalIndex={totalIndex} />;
break;
case "branching":
return <BranchingQuestions totalIndex={totalIndex}/>;
return <BranchingQuestions totalIndex={totalIndex} />;
break;
default:
return <></>;

@ -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: "",