frontPanel/src/pages/Questions/QuestionsPage.tsx

100 lines
2.7 KiB
TypeScript
Raw Normal View History

2023-04-15 09:10:59 +00:00
import Stepper from "@ui_kit/Stepper";
2023-08-03 07:45:06 +00:00
import {
Box,
Button,
IconButton,
Typography,
Paper,
useTheme,
Link,
} from "@mui/material";
import AddPlus from "../../assets/icons/questionsPage/addPlus";
import ArrowLeft from "../../assets/icons/questionsPage/arrowLeft";
2023-08-03 07:45:06 +00:00
import { quizStore } from "@root/quizes";
import { useParams } from "react-router-dom";
import QuestionsPageCard from "./QuestionPageCard";
import { questionStore, createQuestion } from "@root/questions";
import QuestionsList from "./questionList";
export default function QuestionsPage() {
2023-08-03 07:45:06 +00:00
const { listQuizes, updateQuizesList } = quizStore();
const params = Number(useParams().quizId);
const { listQuestions } = questionStore();
2023-08-03 07:45:06 +00:00
const activeStep = listQuizes[params].step;
console.log(listQuestions);
2023-08-03 07:45:06 +00:00
const handleNext = () => {
updateQuizesList(params, { step: listQuizes[params].step + 1 });
};
2023-08-03 07:45:06 +00:00
const handleBack = () => {
let result = listQuizes[params].step - 1;
updateQuizesList(params, { step: result ? result : 1 });
};
2023-08-03 07:45:06 +00:00
const theme = useTheme();
2023-04-15 09:10:59 +00:00
return (
<>
{/*<Stepper activeStep={activeStep} desc={"Задайте вопросы"} />*/}
2023-08-03 07:45:06 +00:00
<Box
sx={{
maxWidth: "796px",
width: "100%",
display: "flex",
justifyContent: "space-between",
margin: "60px 0 40px 0",
}}
>
<Typography variant={"h5"}>Заголовок квиза</Typography>
<Link
sx={{
fontSize: "16px",
lineHeight: "19px",
color: theme.palette.brightPurple.main,
textDecorationColor: theme.palette.brightPurple.main,
}}
>
2023-08-03 07:45:06 +00:00
Свернуть всё
</Link>
</Box>
2023-08-11 06:15:04 +00:00
{/* <DraggableList /> */}
<QuestionsList />
2023-08-03 07:45:06 +00:00
<Box
sx={{
display: "flex",
justifyContent: "space-between",
maxWidth: "796px",
}}
>
<IconButton
2023-08-03 07:45:06 +00:00
onClick={() => {
createQuestion(params);
console.log(listQuestions);
}}
>
2023-04-15 09:10:59 +00:00
<AddPlus />
</IconButton>
<Box sx={{ display: "flex", gap: "8px" }}>
2023-08-03 07:45:06 +00:00
<Button
variant="outlined"
sx={{ padding: "10px 20px", borderRadius: "8px" }}
>
2023-04-15 09:10:59 +00:00
<ArrowLeft />
</Button>
<Button
variant="contained"
sx={{
padding: "10px 20px",
borderRadius: "8px",
background: theme.palette.brightPurple.main,
fontSize: "18px",
}}
onClick={handleNext}
2023-04-15 09:10:59 +00:00
>
Следующий шаг
</Button>
</Box>
</Box>
</>
);
}