fix: add new question button
This commit is contained in:
parent
8c125e4d21
commit
1170f19a90
@ -1,19 +1,19 @@
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
IconButton,
|
||||
Typography,
|
||||
useMediaQuery,
|
||||
useTheme,
|
||||
Box,
|
||||
Button,
|
||||
IconButton,
|
||||
Typography,
|
||||
useMediaQuery,
|
||||
useTheme,
|
||||
} from "@mui/material";
|
||||
import AddPlus from "../../assets/icons/questionsPage/addPlus";
|
||||
import ArrowLeft from "../../assets/icons/questionsPage/arrowLeft";
|
||||
import { quizStore } from "@root/quizes";
|
||||
import { useParams } from "react-router-dom";
|
||||
import {
|
||||
questionStore,
|
||||
createQuestion,
|
||||
updateQuestionsList,
|
||||
questionStore,
|
||||
createQuestion,
|
||||
updateQuestionsList,
|
||||
} from "@root/questions";
|
||||
import { DraggableList } from "./DraggableList";
|
||||
|
||||
@ -22,17 +22,17 @@ import QuizPreview from "@ui_kit/QuizPreview/QuizPreview";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
export default function QuestionsPage() {
|
||||
const { listQuizes, updateQuizesList } = quizStore();
|
||||
const quizId = Number(useParams().quizId);
|
||||
const { listQuestions } = questionStore();
|
||||
const handleNext = () => {
|
||||
updateQuizesList(quizId, { step: listQuizes[quizId].step + 1 });
|
||||
};
|
||||
const { listQuizes, updateQuizesList } = quizStore();
|
||||
const quizId = Number(useParams().quizId);
|
||||
const { listQuestions } = questionStore();
|
||||
const handleNext = () => {
|
||||
updateQuizesList(quizId, { step: listQuizes[quizId].step + 1 });
|
||||
};
|
||||
|
||||
const handleBack = () => {
|
||||
let result = listQuizes[quizId].step - 1;
|
||||
updateQuizesList(quizId, { step: result ? result : 1 });
|
||||
};
|
||||
const handleBack = () => {
|
||||
let result = listQuizes[quizId].step - 1;
|
||||
updateQuizesList(quizId, { step: result ? result : 1 });
|
||||
};
|
||||
|
||||
const collapseEverything = () => {
|
||||
listQuestions[quizId].forEach((item, index) => {
|
||||
@ -43,12 +43,11 @@ export default function QuestionsPage() {
|
||||
});
|
||||
};
|
||||
|
||||
const theme = useTheme();
|
||||
const isTablet = useMediaQuery(theme.breakpoints.up(1000));
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down(660));
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <Stepper activeStep={activeStep} desc={"Задайте вопросы"} /> */}
|
||||
<Box
|
||||
sx={{
|
||||
maxWidth: "796px",
|
||||
@ -85,10 +84,15 @@ export default function QuestionsPage() {
|
||||
onClick={() => {
|
||||
createQuestion(quizId);
|
||||
}}
|
||||
sx={{
|
||||
position: "fixed",
|
||||
left: isMobile ? "20px" : "250px",
|
||||
bottom: "20px",
|
||||
}}
|
||||
>
|
||||
<AddPlus />
|
||||
</IconButton>
|
||||
<Box sx={{ display: "flex", gap: "8px" }}>
|
||||
<Box sx={{ display: "flex", gap: "8px", marginLeft: "auto" }}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
sx={{ padding: "10px 20px", borderRadius: "8px", height: "44px" }}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user