import { Box, ButtonBase, Typography } from "@mui/material"; import { useParams } from "react-router-dom"; import SelectableButton from "@ui_kit/SelectableButton"; import CustomTextField from "@ui_kit/CustomTextField"; import { useState } from "react"; import UploadIcon from "../../assets/icons/UploadIcon"; import UploadBox from "@ui_kit/UploadBox"; import { questionStore, updateQuestionsList } from "@root/questions"; import { UploadVideoModal } from "./UploadVideoModal"; type BackgroundType = "text" | "video"; type HelpQuestionsProps = { totalIndex: number; }; export default function HelpQuestions({ totalIndex }: HelpQuestionsProps) { const [open, setOpen] = useState(false); const [backgroundType, setBackgroundType] = useState("text"); const quizId = Number(useParams().quizId); const { listQuestions } = questionStore(); const videoHC = (url: string) => { const clonContent = listQuestions[quizId][totalIndex].content; clonContent.hint.video = url; updateQuestionsList(quizId, totalIndex, { content: clonContent }); }; return ( Подсказка консультанта setBackgroundType("text")} sx={{ maxWidth: "130px" }} > Текст setBackgroundType("video")} sx={{ maxWidth: "130px" }} > Видео {backgroundType === "text" ? ( <> { let clonContent = listQuestions[quizId][totalIndex].content; clonContent.hint.text = target.value; updateQuestionsList(quizId, totalIndex, { content: clonContent }); }} /> ) : ( Загрузите видео setOpen(true)} sx={{ justifyContent: "flex-start" }} > {listQuestions[quizId][totalIndex].content.hint.video ? ( setOpen(false)} video={listQuestions[quizId][totalIndex].content.hint.video} onUpload={videoHC} /> )} ); }