fix: ButtonsOptions
This commit is contained in:
parent
79b6442377
commit
76186f6a7b
@ -193,7 +193,11 @@ export default function ButtonsOptions({
|
|||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{value !== "setting" && quize.config.type === "quize" && (
|
{(value !== "setting" ||
|
||||||
|
quize.config.type === "quize" ||
|
||||||
|
(value === "setting" &&
|
||||||
|
quize.config.type === "form" &&
|
||||||
|
question.type)) && (
|
||||||
<MiniButtonSetting
|
<MiniButtonSetting
|
||||||
key={title}
|
key={title}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -16,6 +16,7 @@ import { CopyIcon } from "../../assets/icons/questionsPage/CopyIcon";
|
|||||||
import { DeleteIcon } from "../../assets/icons/questionsPage/deleteIcon";
|
import { DeleteIcon } from "../../assets/icons/questionsPage/deleteIcon";
|
||||||
import ImgIcon from "../../assets/icons/questionsPage/imgIcon";
|
import ImgIcon from "../../assets/icons/questionsPage/imgIcon";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { quizStore } from "@root/quizes";
|
||||||
import {
|
import {
|
||||||
questionStore,
|
questionStore,
|
||||||
copyQuestion,
|
copyQuestion,
|
||||||
@ -44,12 +45,14 @@ export default function ButtonsOptionsAndPict({
|
|||||||
}: Props) {
|
}: Props) {
|
||||||
const [buttonHover, setButtonHover] = useState<string>("");
|
const [buttonHover, setButtonHover] = useState<string>("");
|
||||||
const quizId = Number(useParams().quizId);
|
const quizId = Number(useParams().quizId);
|
||||||
|
const { listQuizes } = quizStore();
|
||||||
const { listQuestions } = questionStore();
|
const { listQuestions } = questionStore();
|
||||||
const [openedReallyChangingModal, setOpenedReallyChangingModal] =
|
const [openedReallyChangingModal, setOpenedReallyChangingModal] =
|
||||||
useState<boolean>(false);
|
useState<boolean>(false);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
const isIconMobile = useMediaQuery(theme.breakpoints.down(1050));
|
const isIconMobile = useMediaQuery(theme.breakpoints.down(1050));
|
||||||
|
const quize = listQuizes[quizId];
|
||||||
const question = listQuestions[quizId][totalIndex] as QuizQuestionBase;
|
const question = listQuestions[quizId][totalIndex] as QuizQuestionBase;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -146,6 +149,8 @@ export default function ButtonsOptionsAndPict({
|
|||||||
/>
|
/>
|
||||||
{isIconMobile ? null : "Подсказка"}
|
{isIconMobile ? null : "Подсказка"}
|
||||||
</MiniButtonSetting>
|
</MiniButtonSetting>
|
||||||
|
{quize.config.type === "quize" && (
|
||||||
|
<>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
arrow
|
arrow
|
||||||
placement="right"
|
placement="right"
|
||||||
@ -213,7 +218,9 @@ export default function ButtonsOptionsAndPict({
|
|||||||
: theme.palette.grey3.main,
|
: theme.palette.grey3.main,
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
color:
|
color:
|
||||||
switchState === "branching" ? theme.palette.grey3.main : null,
|
switchState === "branching"
|
||||||
|
? theme.palette.grey3.main
|
||||||
|
: null,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -244,9 +251,12 @@ export default function ButtonsOptionsAndPict({
|
|||||||
? theme.palette.brightPurple.main
|
? theme.palette.brightPurple.main
|
||||||
: "transparent",
|
: "transparent",
|
||||||
color:
|
color:
|
||||||
switchState === "image" ? "#ffffff" : theme.palette.grey3.main,
|
switchState === "image"
|
||||||
|
? "#ffffff"
|
||||||
|
: theme.palette.grey3.main,
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
color: switchState === "image" ? theme.palette.grey3.main : null,
|
color:
|
||||||
|
switchState === "image" ? theme.palette.grey3.main : null,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -291,6 +301,8 @@ export default function ButtonsOptionsAndPict({
|
|||||||
>
|
>
|
||||||
<VectorQuestions style={{ color: "#FC712F", fontSize: "9px" }} />
|
<VectorQuestions style={{ color: "#FC712F", fontSize: "9px" }} />
|
||||||
</MiniButtonSetting>
|
</MiniButtonSetting>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -306,12 +318,6 @@ export default function ButtonsOptionsAndPict({
|
|||||||
>
|
>
|
||||||
<CopyIcon style={{ color: "#4D4D4D" }} />
|
<CopyIcon style={{ color: "#4D4D4D" }} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton
|
|
||||||
sx={{ borderRadius: "6px", padding: " 0px 2px" }}
|
|
||||||
onClick={() => copyQuestion(quizId, totalIndex)}
|
|
||||||
>
|
|
||||||
<CopyIcon color={"#4D4D4D"} />
|
|
||||||
</IconButton>
|
|
||||||
<IconButton
|
<IconButton
|
||||||
sx={{ borderRadius: "6px", padding: "2px" }}
|
sx={{ borderRadius: "6px", padding: "2px" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -201,6 +201,25 @@ export default function QuestionsPageCard({
|
|||||||
onChange={({ target }) => debounced(target.value)}
|
onChange={({ target }) => debounced(target.value)}
|
||||||
sx={{ margin: "20px", width: "auto" }}
|
sx={{ margin: "20px", width: "auto" }}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
|
startAdornment: (
|
||||||
|
<Box>
|
||||||
|
<InputAdornment
|
||||||
|
ref={anchorRef}
|
||||||
|
position="start"
|
||||||
|
sx={{ cursor: "pointer" }}
|
||||||
|
onClick={() => setOpen((isOpened) => !isOpened)}
|
||||||
|
>
|
||||||
|
{IconAndrom(question.expanded, question.type)}
|
||||||
|
</InputAdornment>
|
||||||
|
<ChooseAnswerModal
|
||||||
|
open={open}
|
||||||
|
onClose={() => setOpen(false)}
|
||||||
|
anchorRef={anchorRef}
|
||||||
|
totalIndex={totalIndex}
|
||||||
|
switchState={question.type}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
),
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<>
|
<>
|
||||||
<InputAdornment {...draggableProps} position="start">
|
<InputAdornment {...draggableProps} position="start">
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { useDebouncedCallback } from "use-debounce";
|
|
||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
|
|
||||||
import QuestionsMiniButton from "@ui_kit/QuestionsMiniButton";
|
import QuestionsMiniButton from "@ui_kit/QuestionsMiniButton";
|
||||||
import CustomTextField from "@ui_kit/CustomTextField";
|
|
||||||
import ButtonsOptions from "../ButtonsOptions";
|
import ButtonsOptions from "../ButtonsOptions";
|
||||||
import SwitchAnswerOptions from "../answerOptions/switchAnswerOptions";
|
import SwitchAnswerOptions from "../answerOptions/switchAnswerOptions";
|
||||||
|
|
||||||
@ -105,10 +103,6 @@ export default function FormTypeQuestions({ totalIndex }: Props) {
|
|||||||
const quizId = Number(useParams().quizId);
|
const quizId = Number(useParams().quizId);
|
||||||
const { listQuestions } = questionStore();
|
const { listQuestions } = questionStore();
|
||||||
const question = listQuestions[quizId][totalIndex] as QuizQuestionBase;
|
const question = listQuestions[quizId][totalIndex] as QuizQuestionBase;
|
||||||
const debounced = useDebouncedCallback((title) => {
|
|
||||||
updateQuestionsList<QuizQuestionBase>(quizId, totalIndex, { title });
|
|
||||||
}, 1000);
|
|
||||||
console.log("listQuestions[quizId]", listQuestions[quizId]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
|
Loading…
Reference in New Issue
Block a user