Типы вопросов эмоджи, в-ы, в-ы с кртнкми, в-ы и кртинк выводят новые правила
This commit is contained in:
parent
f301308c74
commit
19b80694cb
@ -7,10 +7,10 @@ import SupplementIcon from "../../assets/icons/ContactFormIcon/supplementIcon";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
switchState: string;
|
switchState: string;
|
||||||
SSHC: (data: string) => void;
|
setSwitchState: (data: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ButtonSettingForms({ SSHC, switchState }: Props) {
|
export default function ButtonSettingForms({ setSwitchState, switchState }: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const buttonSetting: { icon: JSX.Element; title: string; value: string }[] = [
|
const buttonSetting: { icon: JSX.Element; title: string; value: string }[] = [
|
||||||
{
|
{
|
||||||
@ -68,7 +68,7 @@ export default function ButtonSettingForms({ SSHC, switchState }: Props) {
|
|||||||
<MiniButtonSetting
|
<MiniButtonSetting
|
||||||
key={i}
|
key={i}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
SSHC(e.value);
|
setSwitchState(e.value);
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
|
@ -3,7 +3,7 @@ import { useCallback, useState } from "react";
|
|||||||
import { EnterIcon } from "../../../assets/icons/questionsPage/enterIcon";
|
import { EnterIcon } from "../../../assets/icons/questionsPage/enterIcon";
|
||||||
import { useAddAnswer } from "../../../utils/hooks/useAddAnswer";
|
import { useAddAnswer } from "../../../utils/hooks/useAddAnswer";
|
||||||
import { AnswerDraggableList } from "../AnswerDraggableList";
|
import { AnswerDraggableList } from "../AnswerDraggableList";
|
||||||
import ButtonsOptions from "../QuestionOptions/ButtonsOptions/ButtonsOptions";
|
import ButtonsOptions from "../QuestionOptions/ButtonsLayout/ButtonsOptions";
|
||||||
import SwitchDropDown from "./switchDropDown";
|
import SwitchDropDown from "./switchDropDown";
|
||||||
|
|
||||||
import type { QuizQuestionSelect } from "@frontend/squzanswerer";
|
import type { QuizQuestionSelect } from "@frontend/squzanswerer";
|
||||||
@ -100,7 +100,7 @@ export default function DropDown({ question, openBranchingPage, setOpenBranching
|
|||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptions
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionType={question.type}
|
questionType={question.type}
|
||||||
|
@ -6,7 +6,7 @@ import { EnterIcon } from "../../../assets/icons/questionsPage/enterIcon";
|
|||||||
import type { QuizQuestionEmoji } from "@frontend/squzanswerer";
|
import type { QuizQuestionEmoji } from "@frontend/squzanswerer";
|
||||||
import { useAddAnswer } from "../../../utils/hooks/useAddAnswer";
|
import { useAddAnswer } from "../../../utils/hooks/useAddAnswer";
|
||||||
import { AnswerDraggableList } from "../AnswerDraggableList";
|
import { AnswerDraggableList } from "../AnswerDraggableList";
|
||||||
import ButtonsOptions from "../QuestionOptions/ButtonsOptions/ButtonsOptions";
|
import ButtonsOptions from "../QuestionOptions/ButtonsLayout/ButtonsOptions";
|
||||||
import EmojiAnswerItem from "./EmojiAnswerItem/EmojiAnswerItem";
|
import EmojiAnswerItem from "./EmojiAnswerItem/EmojiAnswerItem";
|
||||||
import SwitchEmoji from "./switchEmoji";
|
import SwitchEmoji from "./switchEmoji";
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ export default function Emoji({ question, openBranchingPage, setOpenBranchingPag
|
|||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptions
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionType={question.type}
|
questionType={question.type}
|
||||||
|
@ -3,21 +3,31 @@ import { Box, Typography, useMediaQuery, useTheme } from "@mui/material";
|
|||||||
import { updateQuestion } from "@root/questions/actions";
|
import { updateQuestion } from "@root/questions/actions";
|
||||||
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
||||||
import { memo } from "react";
|
import { memo } from "react";
|
||||||
|
import CustomTextField from "@ui_kit/CustomTextField";
|
||||||
|
|
||||||
type SettingEmojiProps = {
|
type SettingEmojiProps = {
|
||||||
questionId: string;
|
questionId: string;
|
||||||
isRequired: boolean;
|
isRequired: boolean;
|
||||||
isMulti: boolean;
|
isMulti: boolean;
|
||||||
isOwn: boolean;
|
isOwn: boolean;
|
||||||
|
isLargeCheck?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingEmoji = memo<SettingEmojiProps>(function ({ questionId, isRequired, isMulti, isOwn }) {
|
const SettingEmoji = memo<SettingEmojiProps>(function ({ questionId, ownPlaceholder, isRequired, isLargeCheck, isMulti, isOwn }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isWrappColumn = useMediaQuery(theme.breakpoints.down(980));
|
const isWrappColumn = useMediaQuery(theme.breakpoints.down(980));
|
||||||
const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990));
|
const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990));
|
||||||
const isTablet = useMediaQuery(theme.breakpoints.down(985));
|
const isTablet = useMediaQuery(theme.breakpoints.down(985));
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
|
|
||||||
|
const setOwnPlaceholder = (replText: string) => {
|
||||||
|
updateQuestion(questionId, (question) => {
|
||||||
|
if (question.type !== "varimg") return;
|
||||||
|
|
||||||
|
question.content.ownPlaceholder = replText;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -29,7 +39,7 @@ const SettingEmoji = memo<SettingEmojiProps>(function ({ questionId, isRequired,
|
|||||||
pt: isTablet ? "5px" : "0px",
|
pt: isTablet ? "5px" : "0px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
pt: "20px",
|
pt: "20px",
|
||||||
@ -50,6 +60,17 @@ const SettingEmoji = memo<SettingEmojiProps>(function ({ questionId, isRequired,
|
|||||||
>
|
>
|
||||||
Настройки ответов
|
Настройки ответов
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<CustomCheckbox
|
||||||
|
dataCy="checkbox-long-text-answer"
|
||||||
|
sx={{ mr: isMobile ? "0px" : "16px" }}
|
||||||
|
label={"Многострочный ответ"}
|
||||||
|
checked={isLargeCheck}
|
||||||
|
handleChange={({ target }) => {
|
||||||
|
updateQuestion<QuizQuestionVariant>(questionId, (question) => {
|
||||||
|
question.content.largeCheck = target.checked;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<CustomCheckbox
|
<CustomCheckbox
|
||||||
dataCy="checkbox-multiple-answers"
|
dataCy="checkbox-multiple-answers"
|
||||||
sx={{ mr: isMobile ? "0px" : "16px" }}
|
sx={{ mr: isMobile ? "0px" : "16px" }}
|
||||||
@ -72,7 +93,31 @@ const SettingEmoji = memo<SettingEmojiProps>(function ({ questionId, isRequired,
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box> */}
|
<Box sx={{ mt: isMobile ? "11px" : "6px", width: "100%" }}>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
height: isMobile ? "18px" : "auto",
|
||||||
|
fontWeight: "500",
|
||||||
|
fontSize: "18px",
|
||||||
|
color: " #4D4D4D",
|
||||||
|
mb: "14px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Подсказка "своего ответа"
|
||||||
|
</Typography>
|
||||||
|
<CustomTextField
|
||||||
|
sx={{
|
||||||
|
maxWidth: "330px",
|
||||||
|
width: "100%",
|
||||||
|
mr: isMobile ? "0px" : "16px",
|
||||||
|
}}
|
||||||
|
maxLength={60}
|
||||||
|
placeholder={"мой ответ: три"}
|
||||||
|
value={ownPlaceholder}
|
||||||
|
onChange={({ target }) => setOwnPlaceholder(target.value)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
pt: "20px",
|
pt: "20px",
|
||||||
|
@ -16,6 +16,8 @@ export default function SwitchEmoji({ switchState = "setting", question }: Props
|
|||||||
isRequired={question.content.required}
|
isRequired={question.content.required}
|
||||||
isOwn={question.content.own}
|
isOwn={question.content.own}
|
||||||
isMulti={question.content.multi}
|
isMulti={question.content.multi}
|
||||||
|
isLargeCheck={question.content.isLargeCheck}
|
||||||
|
ownPlaceholder={question.content.ownPlaceholder}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case "help":
|
case "help":
|
||||||
|
@ -5,7 +5,7 @@ import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import InfoIcon from "../../../assets/icons/InfoIcon";
|
import InfoIcon from "../../../assets/icons/InfoIcon";
|
||||||
import type { QuizQuestionText } from "@frontend/squzanswerer";
|
import type { QuizQuestionText } from "@frontend/squzanswerer";
|
||||||
import ButtonsOptionsAndPict from "../QuestionOptions/ButtonsOptions/ButtonsOptionsAndPict";
|
import ButtonsOptions from "../QuestionOptions/ButtonsLayout/ButtonsOptions";
|
||||||
import SwitchTextField from "./switchTextField";
|
import SwitchTextField from "./switchTextField";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -90,9 +90,9 @@ export default function OwnTextField({ question, openBranchingPage, setOpenBranc
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptionsAndPict
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionHasParent={question.content.rule.parentId?.length !== 0}
|
questionHasParent={question.content.rule.parentId?.length !== 0}
|
||||||
|
@ -30,17 +30,19 @@ import { DeleteBranchingQuestionModal } from "./DeleteBranchingQuestionModal";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
switchState: string;
|
switchState: string;
|
||||||
SSHC: (data: string) => void;
|
setSwitchState: (data: string) => void;
|
||||||
openBranchingPage: boolean;
|
openBranchingPage: boolean;
|
||||||
setOpenBranchingPage: (a: boolean) => void;
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
questionId: string;
|
questionId: string;
|
||||||
questionType: QuestionType;
|
questionType: QuestionType;
|
||||||
questionContentId: string;
|
questionContentId: string;
|
||||||
questionHasParent: boolean;
|
questionHasParent: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
const ButtonsOptionsAndPict = memo<Props>(function ({
|
const IgnoreImage = ["images", "emoji", "number", "date", "select", "text", "file", "rating"]
|
||||||
SSHC,
|
|
||||||
|
const ButtonsOptions = memo<Props>(function ({
|
||||||
|
setSwitchState,
|
||||||
switchState,
|
switchState,
|
||||||
openBranchingPage,
|
openBranchingPage,
|
||||||
setOpenBranchingPage,
|
setOpenBranchingPage,
|
||||||
@ -49,17 +51,17 @@ const ButtonsOptionsAndPict = memo<Props>(function ({
|
|||||||
questionContentId,
|
questionContentId,
|
||||||
questionHasParent,
|
questionHasParent,
|
||||||
}) {
|
}) {
|
||||||
|
const theme = useTheme();
|
||||||
|
const quiz = useCurrentQuiz();
|
||||||
|
const isQuestionFirst = useQuestionsStore((state) => state.questions[0]?.id === questionId,);
|
||||||
|
|
||||||
|
const isIconMobile = useMediaQuery(theme.breakpoints.down(1050));
|
||||||
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
|
const isIgnoreImage = !IgnoreImage.includes(questionType)
|
||||||
|
|
||||||
const [buttonHover, setButtonHover] = useState<string>("");
|
const [buttonHover, setButtonHover] = useState<string>("");
|
||||||
const [openedReallyChangingModal, setOpenedReallyChangingModal] = useState<boolean>(false);
|
const [openedReallyChangingModal, setOpenedReallyChangingModal] = useState<boolean>(false);
|
||||||
const theme = useTheme();
|
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
|
||||||
const isIconMobile = useMediaQuery(theme.breakpoints.down(1050));
|
|
||||||
const quiz = useCurrentQuiz();
|
|
||||||
const [openDelete, setOpenDelete] = useState<boolean>(false);
|
const [openDelete, setOpenDelete] = useState<boolean>(false);
|
||||||
const isQuestionFirst = useQuestionsStore(
|
|
||||||
(state) => state.questions[0]?.id === questionId,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!quiz) return null;
|
if (!quiz) return null;
|
||||||
|
|
||||||
@ -74,7 +76,6 @@ const ButtonsOptionsAndPict = memo<Props>(function ({
|
|||||||
height: isMobile ? "92px" : "70px",
|
height: isMobile ? "92px" : "70px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
ButtonsOptionsAndPict
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
padding: isMobile ? " 3px 12px 11px" : "20px",
|
padding: isMobile ? " 3px 12px 11px" : "20px",
|
||||||
@ -88,7 +89,7 @@ const ButtonsOptionsAndPict = memo<Props>(function ({
|
|||||||
onMouseEnter={() => setButtonHover("setting")}
|
onMouseEnter={() => setButtonHover("setting")}
|
||||||
onMouseLeave={() => setButtonHover("")}
|
onMouseLeave={() => setButtonHover("")}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
SSHC("setting");
|
switchState === "setting" ? setSwitchState("") : setSwitchState("setting");
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
maxWidth: "104px",
|
maxWidth: "104px",
|
||||||
@ -156,38 +157,40 @@ const ButtonsOptionsAndPict = memo<Props>(function ({
|
|||||||
{isIconMobile ? null : "Ветвление"}
|
{isIconMobile ? null : "Ветвление"}
|
||||||
</MiniButtonSetting>
|
</MiniButtonSetting>
|
||||||
)}
|
)}
|
||||||
<MiniButtonSetting
|
{isIgnoreImage &&
|
||||||
onMouseEnter={() => setButtonHover("image")}
|
<MiniButtonSetting
|
||||||
onMouseLeave={() => setButtonHover("")}
|
onMouseEnter={() => setButtonHover("image")}
|
||||||
onClick={() => {
|
onMouseLeave={() => setButtonHover("")}
|
||||||
SSHC("image");
|
onClick={() => {
|
||||||
}}
|
switchState === "image" ? setSwitchState("") : setSwitchState("image");
|
||||||
sx={{
|
}}
|
||||||
height: "30px",
|
sx={{
|
||||||
maxWidth: "123px",
|
height: "30px",
|
||||||
minWidth: isIconMobile ? "30px" : "64px",
|
maxWidth: "123px",
|
||||||
backgroundColor:
|
minWidth: isIconMobile ? "30px" : "64px",
|
||||||
switchState === "image"
|
backgroundColor:
|
||||||
? theme.palette.brightPurple.main
|
switchState === "image"
|
||||||
: "transparent",
|
? theme.palette.brightPurple.main
|
||||||
color:
|
: "transparent",
|
||||||
switchState === "image" ? "#ffffff" : theme.palette.grey3.main,
|
color:
|
||||||
"&:hover": {
|
switchState === "image" ? "#ffffff" : theme.palette.grey3.main,
|
||||||
color: switchState === "image" ? theme.palette.grey3.main : null,
|
"&:hover": {
|
||||||
},
|
color: switchState === "image" ? theme.palette.grey3.main : null,
|
||||||
}}
|
},
|
||||||
>
|
}}
|
||||||
<ImgIcon
|
>
|
||||||
color={
|
<ImgIcon
|
||||||
buttonHover === "image"
|
color={
|
||||||
? theme.palette.grey3.main
|
buttonHover === "image"
|
||||||
: switchState === "image"
|
? theme.palette.grey3.main
|
||||||
? "#ffffff"
|
: switchState === "image"
|
||||||
: theme.palette.grey3.main
|
? "#ffffff"
|
||||||
}
|
: theme.palette.grey3.main
|
||||||
/>
|
}
|
||||||
{isIconMobile ? null : "Изображение"}
|
/>
|
||||||
</MiniButtonSetting>
|
{isIconMobile ? null : "Изображение"}
|
||||||
|
</MiniButtonSetting>
|
||||||
|
}
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -220,12 +223,12 @@ const ButtonsOptionsAndPict = memo<Props>(function ({
|
|||||||
<DeleteIcon style={{ color: "#4D4D4D" }} />
|
<DeleteIcon style={{ color: "#4D4D4D" }} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
<DeleteBranchingQuestionModal
|
|
||||||
open={openDelete}
|
|
||||||
onclose={() => setOpenDelete(false)}
|
|
||||||
questionId={questionId}
|
|
||||||
/>
|
|
||||||
</Box>
|
</Box>
|
||||||
|
<DeleteBranchingQuestionModal
|
||||||
|
open={openDelete}
|
||||||
|
onclose={() => setOpenDelete(false)}
|
||||||
|
questionId={questionId}
|
||||||
|
/>
|
||||||
<ReallyChangingModal
|
<ReallyChangingModal
|
||||||
opened={openedReallyChangingModal}
|
opened={openedReallyChangingModal}
|
||||||
onClose={() => setOpenedReallyChangingModal(false)}
|
onClose={() => setOpenedReallyChangingModal(false)}
|
||||||
@ -234,6 +237,4 @@ const ButtonsOptionsAndPict = memo<Props>(function ({
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
ButtonsOptionsAndPict.displayName = "ButtonsOptionsAndPict";
|
export default ButtonsOptions;
|
||||||
|
|
||||||
export default ButtonsOptionsAndPict;
|
|
@ -17,7 +17,7 @@ import { DeleteBranchingQuestionModal } from "./DeleteBranchingQuestionModal";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
switchState: string;
|
switchState: string;
|
||||||
SSHC: (data: string) => void;
|
setSwitchState: (data: string) => void;
|
||||||
questionId: string;
|
questionId: string;
|
||||||
questionContentId: string;
|
questionContentId: string;
|
||||||
questionType: QuestionType;
|
questionType: QuestionType;
|
||||||
@ -26,8 +26,8 @@ interface Props {
|
|||||||
sx?: SxProps;
|
sx?: SxProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ButtonsOptions = memo<Props>(function ({
|
const lalalalala = memo<Props>(function ({
|
||||||
SSHC,
|
setSwitchState,
|
||||||
switchState,
|
switchState,
|
||||||
questionId,
|
questionId,
|
||||||
questionContentId,
|
questionContentId,
|
||||||
@ -120,7 +120,7 @@ const ButtonsOptions = memo<Props>(function ({
|
|||||||
<MiniButtonSetting
|
<MiniButtonSetting
|
||||||
key={title}
|
key={title}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
SSHC(value);
|
setSwitchState(value);
|
||||||
myFunc();
|
myFunc();
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
@ -1,54 +0,0 @@
|
|||||||
//Передаём сюда тип вопроса и получаем нужный набор
|
|
||||||
|
|
||||||
const KIT = {
|
|
||||||
variant: {
|
|
||||||
settings: ["required"],
|
|
||||||
branch: true,
|
|
||||||
image: true,
|
|
||||||
},
|
|
||||||
images: {
|
|
||||||
settings: [],
|
|
||||||
branch: true,
|
|
||||||
image: true,
|
|
||||||
},
|
|
||||||
varimg: {
|
|
||||||
settings: [],
|
|
||||||
branch: true,
|
|
||||||
image: true,
|
|
||||||
},
|
|
||||||
emoji: {
|
|
||||||
settings: [],
|
|
||||||
branch: true,
|
|
||||||
image: true,
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
settings: [],
|
|
||||||
branch: true,
|
|
||||||
image: true,
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
settings: [],
|
|
||||||
branch: true,
|
|
||||||
image: true,
|
|
||||||
},
|
|
||||||
date: {
|
|
||||||
settings: [],
|
|
||||||
branch: true,
|
|
||||||
image: true,
|
|
||||||
},
|
|
||||||
number: {
|
|
||||||
settings: [],
|
|
||||||
branch: true,
|
|
||||||
image: true,
|
|
||||||
},
|
|
||||||
file: {
|
|
||||||
settings: [],
|
|
||||||
branch: true,
|
|
||||||
image: false,
|
|
||||||
},
|
|
||||||
rating: {
|
|
||||||
settings: [],
|
|
||||||
branch: true,
|
|
||||||
image: true,
|
|
||||||
},
|
|
||||||
}
|
|
@ -1,8 +1,8 @@
|
|||||||
import { Box, Tooltip, Typography, useMediaQuery, useTheme } from "@mui/material";
|
import { Box, Tooltip, Typography, useMediaQuery, useTheme } from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import InfoIcon from "@/assets/icons/InfoIcon";
|
import InfoIcon from "@/assets/icons/InfoIcon";
|
||||||
import ButtonsOptions from "../ButtonsOptions/ButtonsOptions";
|
import ButtonsOptions from "../ButtonsLayout/ButtonsOptions";
|
||||||
import SwitchData from "./switchData";
|
import SwitchDate from "./switchDate";
|
||||||
import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
|
import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
|
||||||
import { QuizQuestionDate } from "@frontend/squzanswerer";
|
import { QuizQuestionDate } from "@frontend/squzanswerer";
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ interface Props {
|
|||||||
setOpenBranchingPage: (a: boolean) => void;
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function DataOptions({ question, openBranchingPage, setOpenBranchingPage }: Props) {
|
export default function DateOptions({ question, openBranchingPage, setOpenBranchingPage }: Props) {
|
||||||
const [switchState, setSwitchState] = useState("setting");
|
const [switchState, setSwitchState] = useState("setting");
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
@ -64,14 +64,14 @@ export default function DataOptions({ question, openBranchingPage, setOpenBranch
|
|||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptions
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionType={question.type}
|
questionType={question.type}
|
||||||
questionHasParent={question.content.rule.parentId?.length !== 0}
|
questionHasParent={question.content.rule.parentId?.length !== 0}
|
||||||
setOpenBranchingPage={setOpenBranchingPage}
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchData
|
<SwitchDate
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
question={question}
|
question={question}
|
||||||
/>
|
/>
|
@ -1,6 +1,6 @@
|
|||||||
import { QuizQuestionDate } from "@frontend/squzanswerer";
|
import { QuizQuestionDate } from "@frontend/squzanswerer";
|
||||||
import HelpQuestions from "../../helpQuestions";
|
import HelpQuestions from "../../helpQuestions";
|
||||||
import SettingData from "./settingData";
|
import SettingDate from "./settingDate";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
switchState: string;
|
switchState: string;
|
||||||
@ -11,7 +11,7 @@ export default function SwitchData({ switchState = "setting", question }: Props)
|
|||||||
switch (switchState) {
|
switch (switchState) {
|
||||||
case "setting":
|
case "setting":
|
||||||
return (
|
return (
|
||||||
<SettingData
|
<SettingDate
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
isRequired={question.content.required}
|
isRequired={question.content.required}
|
||||||
isDateRange={question.content.dateRange}
|
isDateRange={question.content.dateRange}
|
@ -8,7 +8,7 @@ import type { QuizQuestionVarImg } from "@frontend/squzanswerer";
|
|||||||
import { useDisclosure } from "@/utils/useDisclosure";
|
import { useDisclosure } from "@/utils/useDisclosure";
|
||||||
import { AnswerDraggableList } from "../../AnswerDraggableList";
|
import { AnswerDraggableList } from "../../AnswerDraggableList";
|
||||||
import ImageEditAnswerItem from "../../AnswerDraggableList/ImageEditAnswerItem";
|
import ImageEditAnswerItem from "../../AnswerDraggableList/ImageEditAnswerItem";
|
||||||
import ButtonsOptionsAndPict from "../ButtonsOptions/ButtonsOptionsAndPict";
|
import ButtonsOptions from "../ButtonsLayout/ButtonsOptions";
|
||||||
import { UploadImageModal } from "../../UploadImage/UploadImageModal";
|
import { UploadImageModal } from "../../UploadImage/UploadImageModal";
|
||||||
import SwitchOptionsAndPict from "./switchOptionsAndPict";
|
import SwitchOptionsAndPict from "./switchOptionsAndPict";
|
||||||
|
|
||||||
@ -152,9 +152,9 @@ export default function OptionsAndPicture({ question, setOpenBranchingPage }: Pr
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptionsAndPict
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionHasParent={question.content.rule.parentId?.length !== 0}
|
questionHasParent={question.content.rule.parentId?.length !== 0}
|
||||||
|
@ -9,10 +9,13 @@ type SettingOptionsAndPictProps = {
|
|||||||
questionId: string;
|
questionId: string;
|
||||||
replText: string;
|
replText: string;
|
||||||
isRequired: boolean;
|
isRequired: boolean;
|
||||||
|
isLargeCheck: boolean;
|
||||||
isOwn: boolean;
|
isOwn: boolean;
|
||||||
|
ownPlaceholder?: boolean;
|
||||||
|
isMulti?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingOptionsAndPict = memo<SettingOptionsAndPictProps>(function ({ questionId, replText, isRequired, isOwn }) {
|
const SettingOptionsAndPict = memo<SettingOptionsAndPictProps>(function ({ questionId, ownPlaceholder, isMulti, isLargeCheck, replText, isRequired, isOwn }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isWrappColumn = useMediaQuery(theme.breakpoints.down(980));
|
const isWrappColumn = useMediaQuery(theme.breakpoints.down(980));
|
||||||
const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990));
|
const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990));
|
||||||
@ -26,6 +29,13 @@ const SettingOptionsAndPict = memo<SettingOptionsAndPictProps>(function ({ quest
|
|||||||
question.content.replText = replText;
|
question.content.replText = replText;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const setOwnPlaceholder = (replText: string) => {
|
||||||
|
updateQuestion(questionId, (question) => {
|
||||||
|
if (question.type !== "varimg") return;
|
||||||
|
|
||||||
|
question.content.ownPlaceholder = replText;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -49,7 +59,7 @@ const SettingOptionsAndPict = memo<SettingOptionsAndPictProps>(function ({ quest
|
|||||||
width: "100%",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
height: isMobile ? "18px" : "auto",
|
height: isMobile ? "18px" : "auto",
|
||||||
fontWeight: "500",
|
fontWeight: "500",
|
||||||
@ -58,18 +68,64 @@ const SettingOptionsAndPict = memo<SettingOptionsAndPictProps>(function ({ quest
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Настройки ответов
|
Настройки ответов
|
||||||
</Typography> */}
|
</Typography>
|
||||||
{/* <CustomCheckbox
|
<CustomCheckbox
|
||||||
dataCy="checkbox-own-answer"
|
dataCy="checkbox-long-text-answer"
|
||||||
sx={{ mr: isMobile ? "0px" : "16px" }}
|
sx={{ mr: isMobile ? "0px" : "16px" }}
|
||||||
label={'Вариант "свой ответ"'}
|
label={"Многострочный ответ"}
|
||||||
checked={isOwn}
|
checked={isLargeCheck}
|
||||||
handleChange={({ target }) => {
|
handleChange={({ target }) => {
|
||||||
updateQuestion<QuizQuestionVariant>(questionId, (question) => {
|
updateQuestion<QuizQuestionVariant>(questionId, (question) => {
|
||||||
question.content.own = target.checked;
|
question.content.largeCheck = target.checked;
|
||||||
});
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<CustomCheckbox
|
||||||
|
dataCy="checkbox-multiple-answers"
|
||||||
|
sx={{ mr: isMobile ? "0px" : "16px" }}
|
||||||
|
label={"Можно несколько"}
|
||||||
|
checked={isMulti}
|
||||||
|
handleChange={({ target }) => {
|
||||||
|
updateQuestion<QuizQuestionVariant>(questionId, (question) => {
|
||||||
|
question.content.multi = target.checked;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<CustomCheckbox
|
||||||
|
dataCy="checkbox-own-answer"
|
||||||
|
sx={{ mr: isMobile ? "0px" : "16px" }}
|
||||||
|
label={'Вариант "свой ответ"'}
|
||||||
|
checked={isOwn}
|
||||||
|
handleChange={({ target }) => {
|
||||||
|
updateQuestion<QuizQuestionVariant>(questionId, (question) => {
|
||||||
|
question.content.own = target.checked;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Box sx={{ mt: isMobile ? "11px" : "6px", width: "100%" }}>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
height: isMobile ? "18px" : "auto",
|
||||||
|
fontWeight: "500",
|
||||||
|
fontSize: "18px",
|
||||||
|
color: " #4D4D4D",
|
||||||
|
mb: "14px",
|
||||||
}}
|
}}
|
||||||
/> */}
|
>
|
||||||
|
Подсказка "своего ответа"
|
||||||
|
</Typography>
|
||||||
|
<CustomTextField
|
||||||
|
sx={{
|
||||||
|
maxWidth: "330px",
|
||||||
|
width: "100%",
|
||||||
|
mr: isMobile ? "0px" : "16px",
|
||||||
|
}}
|
||||||
|
maxLength={60}
|
||||||
|
placeholder={"мой ответ: три"}
|
||||||
|
value={ownPlaceholder}
|
||||||
|
onChange={({ target }) => setOwnPlaceholder(target.value)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
{!isWrappColumn && (
|
{!isWrappColumn && (
|
||||||
<Box sx={{ mt: isMobile ? "11px" : "6px", width: "100%" }}>
|
<Box sx={{ mt: isMobile ? "11px" : "6px", width: "100%" }}>
|
||||||
<Typography
|
<Typography
|
||||||
|
@ -9,6 +9,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function SwitchOptionsAndPict({ switchState = "setting", question }: Props) {
|
export default function SwitchOptionsAndPict({ switchState = "setting", question }: Props) {
|
||||||
|
console.log(question)
|
||||||
switch (switchState) {
|
switch (switchState) {
|
||||||
case "setting":
|
case "setting":
|
||||||
return (
|
return (
|
||||||
@ -17,6 +18,8 @@ export default function SwitchOptionsAndPict({ switchState = "setting", question
|
|||||||
replText={question.content.replText}
|
replText={question.content.replText}
|
||||||
isRequired={question.content.required}
|
isRequired={question.content.required}
|
||||||
isOwn={question.content.own}
|
isOwn={question.content.own}
|
||||||
|
isLargeCheck={question.content.largeCheck}
|
||||||
|
isMulti={question.content.multi}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case "help":
|
case "help":
|
||||||
|
@ -9,7 +9,7 @@ import { useAddAnswer } from "@/utils/hooks/useAddAnswer";
|
|||||||
import { useDisclosure } from "@/utils/useDisclosure";
|
import { useDisclosure } from "@/utils/useDisclosure";
|
||||||
import { AnswerDraggableList } from "../../AnswerDraggableList";
|
import { AnswerDraggableList } from "../../AnswerDraggableList";
|
||||||
import ImageEditAnswerItem from "../../AnswerDraggableList/ImageEditAnswerItem";
|
import ImageEditAnswerItem from "../../AnswerDraggableList/ImageEditAnswerItem";
|
||||||
import ButtonsOptions from "../ButtonsOptions/ButtonsOptions";
|
import ButtonsOptions from "../ButtonsLayout/ButtonsOptions";
|
||||||
import { UploadImageModal } from "../../UploadImage/UploadImageModal";
|
import { UploadImageModal } from "../../UploadImage/UploadImageModal";
|
||||||
import SwitchAnswerOptionsPict from "./switchOptionsPict";
|
import SwitchAnswerOptionsPict from "./switchOptionsPict";
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ export default function OptionsPicture({ question, openBranchingPage, setOpenBra
|
|||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptions
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionType={question.type}
|
questionType={question.type}
|
||||||
|
@ -8,6 +8,7 @@ import FormatIcon2 from "@/assets/icons/questionsPage/FormatIcon2";
|
|||||||
import ProportionsIcon11 from "@/assets/icons/questionsPage/ProportionsIcon11";
|
import ProportionsIcon11 from "@/assets/icons/questionsPage/ProportionsIcon11";
|
||||||
import ProportionsIcon12 from "@/assets/icons/questionsPage/ProportionsIcon12";
|
import ProportionsIcon12 from "@/assets/icons/questionsPage/ProportionsIcon12";
|
||||||
import ProportionsIcon21 from "@/assets/icons/questionsPage/ProportionsIcon21";
|
import ProportionsIcon21 from "@/assets/icons/questionsPage/ProportionsIcon21";
|
||||||
|
import CustomTextField from "@ui_kit/CustomTextField";
|
||||||
|
|
||||||
type Proportion = "1:1" | "1:2" | "2:1";
|
type Proportion = "1:1" | "1:2" | "2:1";
|
||||||
|
|
||||||
@ -34,19 +35,21 @@ const FORMATS: FormatItem[] = [
|
|||||||
{ value: "masonry", icon: FormatIcon1 },
|
{ value: "masonry", icon: FormatIcon1 },
|
||||||
];
|
];
|
||||||
|
|
||||||
type SettingOpytionsPictProps = {
|
type SettingOptionsPictProps = {
|
||||||
questionId: string;
|
questionId: string;
|
||||||
isRequired: boolean;
|
isRequired: boolean;
|
||||||
isMulti: boolean;
|
isMulti: boolean;
|
||||||
isOwn: boolean;
|
isOwn: boolean;
|
||||||
proportions: Proportion;
|
proportions: Proportion;
|
||||||
format: Format;
|
format: Format;
|
||||||
|
ownPlaceholder?: boolean;
|
||||||
|
isLargeCheck?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingOptionsPict = memo<SettingOpytionsPictProps>(function ({
|
const SettingOptionsPict = memo<SettingOptionsPictProps>(function ({
|
||||||
questionId,
|
questionId,
|
||||||
isRequired,
|
isRequired,
|
||||||
isMulti,
|
ownPlaceholder, isMulti, isLargeCheck,
|
||||||
isOwn,
|
isOwn,
|
||||||
proportions,
|
proportions,
|
||||||
format,
|
format,
|
||||||
@ -55,6 +58,14 @@ const SettingOptionsPict = memo<SettingOpytionsPictProps>(function ({
|
|||||||
const isTablet = useMediaQuery(theme.breakpoints.down(985));
|
const isTablet = useMediaQuery(theme.breakpoints.down(985));
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990));
|
const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990));
|
||||||
|
|
||||||
|
const setOwnPlaceholder = (replText: string) => {
|
||||||
|
updateQuestion(questionId, (question) => {
|
||||||
|
if (question.type !== "varimg") return;
|
||||||
|
|
||||||
|
question.content.ownPlaceholder = replText;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -68,8 +79,8 @@ const SettingOptionsPict = memo<SettingOpytionsPictProps>(function ({
|
|||||||
pt: isTablet ? "5px" : "0px",
|
pt: isTablet ? "5px" : "0px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
|
<Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
|
||||||
<Box
|
{/* <Box
|
||||||
sx={{
|
sx={{
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
pt: "20px",
|
pt: "20px",
|
||||||
@ -110,7 +121,7 @@ const SettingOptionsPict = memo<SettingOpytionsPictProps>(function ({
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box> */}
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
@ -132,6 +143,17 @@ const SettingOptionsPict = memo<SettingOpytionsPictProps>(function ({
|
|||||||
>
|
>
|
||||||
Настройки ответов
|
Настройки ответов
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<CustomCheckbox
|
||||||
|
dataCy="checkbox-long-text-answer"
|
||||||
|
sx={{ mr: isMobile ? "0px" : "16px" }}
|
||||||
|
label={"Многострочный ответ"}
|
||||||
|
checked={isLargeCheck}
|
||||||
|
handleChange={({ target }) => {
|
||||||
|
updateQuestion<QuizQuestionVariant>(questionId, (question) => {
|
||||||
|
question.content.largeCheck = target.checked;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<CustomCheckbox
|
<CustomCheckbox
|
||||||
dataCy="checkbox-multiple-answers"
|
dataCy="checkbox-multiple-answers"
|
||||||
sx={{ mr: isMobile ? "0px" : "16px" }}
|
sx={{ mr: isMobile ? "0px" : "16px" }}
|
||||||
@ -154,8 +176,32 @@ const SettingOptionsPict = memo<SettingOpytionsPictProps>(function ({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Box sx={{ mt: isMobile ? "11px" : "6px", width: "100%" }}>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
height: isMobile ? "18px" : "auto",
|
||||||
|
fontWeight: "500",
|
||||||
|
fontSize: "18px",
|
||||||
|
color: " #4D4D4D",
|
||||||
|
mb: "14px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Подсказка "своего ответа"
|
||||||
|
</Typography>
|
||||||
|
<CustomTextField
|
||||||
|
sx={{
|
||||||
|
maxWidth: "330px",
|
||||||
|
width: "100%",
|
||||||
|
mr: isMobile ? "0px" : "16px",
|
||||||
|
}}
|
||||||
|
maxLength={60}
|
||||||
|
placeholder={"мой ответ: три"}
|
||||||
|
value={ownPlaceholder}
|
||||||
|
onChange={({ target }) => setOwnPlaceholder(target.value)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box> */}
|
</Box>
|
||||||
<Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
|
<Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
|
||||||
{/* <Box
|
{/* <Box
|
||||||
sx={{
|
sx={{
|
@ -1,6 +1,6 @@
|
|||||||
import { QuizQuestionImages } from "@frontend/squzanswerer";
|
import { QuizQuestionImages } from "@frontend/squzanswerer";
|
||||||
import HelpQuestions from "../../helpQuestions";
|
import HelpQuestions from "../../helpQuestions";
|
||||||
import SettingOpytionsPict from "./settingOpytionsPict";
|
import SettingOptionsPict from "./settingOptionsPict";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
switchState: string;
|
switchState: string;
|
||||||
@ -11,13 +11,16 @@ export default function SwitchAnswerOptionsPict({ switchState = "setting", quest
|
|||||||
switch (switchState) {
|
switch (switchState) {
|
||||||
case "setting":
|
case "setting":
|
||||||
return (
|
return (
|
||||||
<SettingOpytionsPict
|
<SettingOptionsPict
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
isRequired={question.content.required}
|
isRequired={question.content.required}
|
||||||
isMulti={question.content.multi}
|
isMulti={question.content.multi}
|
||||||
isOwn={question.content.own}
|
isOwn={question.content.own}
|
||||||
proportions={question.content.xy}
|
proportions={question.content.xy}
|
||||||
format={question.content.format}
|
format={question.content.format}
|
||||||
|
ownPlaceholder={question.content.ownPlaceholder}
|
||||||
|
isLargeCheck={question.content.isLargeCheck}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case "help":
|
case "help":
|
||||||
|
@ -9,7 +9,7 @@ import LightbulbIcon from "@/assets/icons/questionsPage/lightbulbIcon";
|
|||||||
import LikeIcon from "@/assets/icons/questionsPage/likeIcon";
|
import LikeIcon from "@/assets/icons/questionsPage/likeIcon";
|
||||||
import TropfyIcon from "@/assets/icons/questionsPage/tropfyIcon";
|
import TropfyIcon from "@/assets/icons/questionsPage/tropfyIcon";
|
||||||
import type { QuizQuestionRating } from "@frontend/squzanswerer";
|
import type { QuizQuestionRating } from "@frontend/squzanswerer";
|
||||||
import ButtonsOptions from "../ButtonsOptions/ButtonsOptions";
|
import ButtonsOptions from "../ButtonsLayout/ButtonsOptions";
|
||||||
import SwitchRating from "./switchRating";
|
import SwitchRating from "./switchRating";
|
||||||
|
|
||||||
const TextField = MuiTextField as unknown as FC<TextFieldProps>;
|
const TextField = MuiTextField as unknown as FC<TextFieldProps>;
|
||||||
@ -289,7 +289,7 @@ export default function RatingOptions({ question, openBranchingPage, setOpenBran
|
|||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptions
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionType={question.type}
|
questionType={question.type}
|
||||||
|
@ -4,7 +4,7 @@ import { useDebouncedCallback } from "use-debounce";
|
|||||||
|
|
||||||
import CustomNumberField from "@ui_kit/CustomNumberField";
|
import CustomNumberField from "@ui_kit/CustomNumberField";
|
||||||
|
|
||||||
import ButtonsOptions from "../ButtonsOptions/ButtonsOptions";
|
import ButtonsOptions from "../ButtonsLayout/ButtonsOptions";
|
||||||
import SwitchSlider from "./switchSlider";
|
import SwitchSlider from "./switchSlider";
|
||||||
|
|
||||||
import { updateQuestion } from "@root/questions/actions";
|
import { updateQuestion } from "@root/questions/actions";
|
||||||
@ -209,7 +209,7 @@ export default function SliderOptions({ question, openBranchingPage, setOpenBran
|
|||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptions
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionType={question.type}
|
questionType={question.type}
|
||||||
|
@ -5,7 +5,7 @@ import type { QuizQuestionVariant } from "@frontend/squzanswerer";
|
|||||||
import { useAddAnswer } from "@/utils/hooks/useAddAnswer";
|
import { useAddAnswer } from "@/utils/hooks/useAddAnswer";
|
||||||
import { AnswerDraggableList } from "../../AnswerDraggableList";
|
import { AnswerDraggableList } from "../../AnswerDraggableList";
|
||||||
import AnswerItem from "../../AnswerDraggableList/AnswerItem";
|
import AnswerItem from "../../AnswerDraggableList/AnswerItem";
|
||||||
import ButtonsOptionsAndPict from "../ButtonsOptions/ButtonsOptionsAndPict";
|
import ButtonsOptions from "../ButtonsLayout/ButtonsOptions";
|
||||||
import SwitchAnswerOptions from "./switchAnswerOptions";
|
import SwitchAnswerOptions from "./switchAnswerOptions";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -100,9 +100,9 @@ export default function AnswerOptions({ question, openBranchingPage, setOpenBran
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptionsAndPict
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionHasParent={question.content.rule.parentId?.length !== 0}
|
questionHasParent={question.content.rule.parentId?.length !== 0}
|
||||||
|
@ -3,6 +3,7 @@ import { updateQuestion } from "@root/questions/actions";
|
|||||||
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
||||||
import type { QuizQuestionVariant } from "@frontend/squzanswerer";
|
import type { QuizQuestionVariant } from "@frontend/squzanswerer";
|
||||||
import { memo } from "react";
|
import { memo } from "react";
|
||||||
|
import CustomTextField from "@ui_kit/CustomTextField";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
questionId: string;
|
questionId: string;
|
||||||
@ -10,13 +11,21 @@ interface Props {
|
|||||||
isLargeCheck: boolean;
|
isLargeCheck: boolean;
|
||||||
isMulti: boolean;
|
isMulti: boolean;
|
||||||
isOwn: boolean;
|
isOwn: boolean;
|
||||||
|
ownPlaceholder?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ResponseSettings = memo<Props>(function ({ questionId, isRequired, isLargeCheck, isMulti, isOwn }) {
|
const ResponseSettings = memo<Props>(function ({ questionId, ownPlaceholder, isRequired, isLargeCheck, isMulti, isOwn }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isTablet = useMediaQuery(theme.breakpoints.down(900));
|
const isTablet = useMediaQuery(theme.breakpoints.down(900));
|
||||||
const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990));
|
const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990));
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
|
const setOwnPlaceholder = (replText: string) => {
|
||||||
|
updateQuestion(questionId, (question) => {
|
||||||
|
if (question.type !== "varimg") return;
|
||||||
|
|
||||||
|
question.content.ownPlaceholder = replText;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -30,7 +39,7 @@ const ResponseSettings = memo<Props>(function ({ questionId, isRequired, isLarge
|
|||||||
pt: isTablet ? "5px" : "0px",
|
pt: isTablet ? "5px" : "0px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
pt: "20px",
|
pt: "20px",
|
||||||
@ -54,7 +63,7 @@ const ResponseSettings = memo<Props>(function ({ questionId, isRequired, isLarge
|
|||||||
<CustomCheckbox
|
<CustomCheckbox
|
||||||
dataCy="checkbox-long-text-answer"
|
dataCy="checkbox-long-text-answer"
|
||||||
sx={{ mr: isMobile ? "0px" : "16px" }}
|
sx={{ mr: isMobile ? "0px" : "16px" }}
|
||||||
label={"Длинный текстовый ответ"}
|
label={"Многострочный ответ"}
|
||||||
checked={isLargeCheck}
|
checked={isLargeCheck}
|
||||||
handleChange={({ target }) => {
|
handleChange={({ target }) => {
|
||||||
updateQuestion<QuizQuestionVariant>(questionId, (question) => {
|
updateQuestion<QuizQuestionVariant>(questionId, (question) => {
|
||||||
@ -84,7 +93,31 @@ const ResponseSettings = memo<Props>(function ({ questionId, isRequired, isLarge
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box> */}
|
<Box sx={{ mt: isMobile ? "11px" : "6px", width: "100%" }}>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
height: isMobile ? "18px" : "auto",
|
||||||
|
fontWeight: "500",
|
||||||
|
fontSize: "18px",
|
||||||
|
color: " #4D4D4D",
|
||||||
|
mb: "14px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Подсказка "своего ответа"
|
||||||
|
</Typography>
|
||||||
|
<CustomTextField
|
||||||
|
sx={{
|
||||||
|
maxWidth: "330px",
|
||||||
|
width: "100%",
|
||||||
|
mr: isMobile ? "0px" : "16px",
|
||||||
|
}}
|
||||||
|
maxLength={60}
|
||||||
|
placeholder={"мой ответ: три"}
|
||||||
|
value={ownPlaceholder}
|
||||||
|
onChange={({ target }) => setOwnPlaceholder(target.value)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
|
@ -18,6 +18,7 @@ export default function SwitchAnswerOptions({ switchState = "setting", question
|
|||||||
isLargeCheck={question.content.largeCheck}
|
isLargeCheck={question.content.largeCheck}
|
||||||
isMulti={question.content.multi}
|
isMulti={question.content.multi}
|
||||||
isOwn={question.content.own}
|
isOwn={question.content.own}
|
||||||
|
isOwnPlaceholder={question.content.ownPlaceholder}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case "help":
|
case "help":
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import DataOptions from "./QuestionOptions/DataOptions/DataOptions";
|
import DateOptions from "./QuestionOptions/DateOptions/DateOptions";
|
||||||
import DropDown from "./DropDown/DropDown";
|
import DropDown from "./DropDown/DropDown";
|
||||||
import Emoji from "./Emoji/Emoji";
|
import Emoji from "./Emoji/Emoji";
|
||||||
import OptionsAndPicture from "./QuestionOptions/OptionsAndPicture/OptionsAndPicture";
|
import OptionsAndPicture from "./QuestionOptions/OptionsAndPicture/OptionsAndPicture";
|
||||||
@ -76,7 +76,7 @@ export default function SwitchQuestionsPage({ question, openBranchingPage, setOp
|
|||||||
|
|
||||||
case "date":
|
case "date":
|
||||||
return (
|
return (
|
||||||
<DataOptions
|
<DateOptions
|
||||||
question={question}
|
question={question}
|
||||||
openBranchingPage={openBranchingPage}
|
openBranchingPage={openBranchingPage}
|
||||||
setOpenBranchingPage={setOpenBranchingPage}
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
@ -13,7 +13,7 @@ import { updateQuestion } from "@root/questions/actions";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import ArrowDown from "../../../assets/icons/ArrowDownIcon";
|
import ArrowDown from "../../../assets/icons/ArrowDownIcon";
|
||||||
import InfoIcon from "../../../assets/icons/InfoIcon";
|
import InfoIcon from "../../../assets/icons/InfoIcon";
|
||||||
import ButtonsOptions from "../QuestionOptions/ButtonsOptions/ButtonsOptions";
|
import ButtonsOptions from "../QuestionOptions/ButtonsLayout/ButtonsOptions";
|
||||||
import SwitchUpload from "./switchUpload";
|
import SwitchUpload from "./switchUpload";
|
||||||
import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
|
import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
|
||||||
import { QuizQuestionFile, UploadFileType } from "@frontend/squzanswerer";
|
import { QuizQuestionFile, UploadFileType } from "@frontend/squzanswerer";
|
||||||
@ -187,7 +187,7 @@ export default function UploadFile({ question, openBranchingPage, setOpenBranchi
|
|||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptions
|
<ButtonsOptions
|
||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={setSwitchState}
|
setSwitchState={setSwitchState}
|
||||||
questionId={question.id}
|
questionId={question.id}
|
||||||
questionContentId={question.content.id}
|
questionContentId={question.content.id}
|
||||||
questionType={question.type}
|
questionType={question.type}
|
||||||
|
@ -10,10 +10,10 @@ import StarIconPoints from "./StarIconsPoints";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
switchState: string;
|
switchState: string;
|
||||||
SSHC: (data: string) => void;
|
setSwitchState: (data: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ButtonsOptionsForm({ SSHC, switchState }: Props) {
|
export default function ButtonsOptionsForm({ setSwitchState, switchState }: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isTablet = useMediaQuery(theme.breakpoints.down(800));
|
const isTablet = useMediaQuery(theme.breakpoints.down(800));
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ export default function ButtonsOptionsForm({ SSHC, switchState }: Props) {
|
|||||||
<MiniButtonSetting
|
<MiniButtonSetting
|
||||||
key={index}
|
key={index}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
SSHC(value);
|
setSwitchState(value);
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
|
@ -24,7 +24,7 @@ export const DescriptionForm = () => {
|
|||||||
setPriceButtonsType(type);
|
setPriceButtonsType(type);
|
||||||
};
|
};
|
||||||
|
|
||||||
const SSHC = (data: string) => {
|
const setSwitchState = (data: string) => {
|
||||||
setSwitchState(data);
|
setSwitchState(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ export const DescriptionForm = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<ButtonsOptionsForm switchState={switchState} SSHC={SSHC} />
|
<ButtonsOptionsForm switchState={switchState} setSwitchState={setSwitchState} />
|
||||||
<SwitchResult switchState={switchState} totalIndex={0} />
|
<SwitchResult switchState={switchState} totalIndex={0} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user