import { useState } from "react"; import { useParams } from "react-router-dom"; import { Box, Typography, useTheme } from "@mui/material"; import ButtonsOptions from "../ButtonsOptions"; import CustomTextField from "@ui_kit/CustomTextField"; import AddImage from "../../../assets/icons/questionsPage/addImage"; import AddVideofile from "../../../assets/icons/questionsPage/addVideofile"; import SwitchPageOptions from "./switchPageOptions"; import { questionStore, updateQuestionsList } from "@root/questions"; import { UploadImageModal } from "../UploadImage/UploadImageModal"; import { UploadVideoModal } from "../UploadVideoModal"; type Props = { disableInput?: boolean; totalIndex: number; }; export default function PageOptions({ disableInput, totalIndex }: Props) { const [openImageModal, setOpenImageModal] = useState(false); const [openVideoModal, setOpenVideoModal] = useState(false); const [switchState, setSwitchState] = useState("setting"); const quizId = Number(useParams().quizId); const { listQuestions } = questionStore(); const theme = useTheme(); const SSHC = (data: string) => { setSwitchState(data); }; return ( <> { const clonContent = listQuestions[quizId][totalIndex].content; clonContent.text = target.value; updateQuestionsList(quizId, totalIndex, { content: clonContent }); }} /> setOpenImageModal(true)} sx={{ cursor: "pointer", display: "flex", alignItems: "center", gap: "10px", }} > Изображение setOpenImageModal(false)} imgHC={(fileList) => { if (fileList?.length) { const clonContent = listQuestions[quizId][totalIndex].content; clonContent.picture = URL.createObjectURL(fileList[0]); updateQuestionsList(quizId, totalIndex, { content: clonContent, }); } }} /> или setOpenVideoModal(true)} sx={{ cursor: "pointer", display: "flex", alignItems: "center", gap: "10px", }} > Видео setOpenVideoModal(false)} video={listQuestions[quizId][totalIndex].content.video} onUpload={(url) => { const clonContent = listQuestions[quizId][totalIndex].content; clonContent.video = url; updateQuestionsList(quizId, totalIndex, { content: clonContent }); }} /> ); }