import { useState, useEffect } from "react"; import { useParams } from "react-router-dom"; import { Box, FormControl, MenuItem, Select, SelectChangeEvent, Typography, useMediaQuery, useTheme, } from "@mui/material"; import ButtonsOptions from "../ButtonsOptions"; import { questionStore, updateQuestionsList } from "@root/questions"; import InfoIcon from "../../../assets/icons/InfoIcon"; import ArrowDown from "../../../assets/icons/ArrowDownIcon"; import SwitchUpload from "./switchUpload"; interface Props { totalIndex: number; } const DESIGN_TYPES = [ { name: "Все типы файлов", value: "all" }, { name: "Изображения", value: "picture" }, { name: "Видео", value: "video" }, { name: "Аудио", value: "audio" }, { name: "Документ", value: "document" }, ]; export default function UploadFile({ totalIndex }: Props) { const [switchState, setSwitchState] = useState("setting"); const quizId = Number(useParams().quizId); const { listQuestions } = questionStore(); const theme = useTheme(); const isTablet = useMediaQuery(theme.breakpoints.down(980)); const isFigmaTablet = useMediaQuery(theme.breakpoints.down(990)); const isMobile = useMediaQuery(theme.breakpoints.down(790)); const SSHC = (data: string) => { setSwitchState(data); }; const handleChange = ({ target }: SelectChangeEvent) => { const clonContent = listQuestions[quizId][totalIndex].content; clonContent.type = target.value; updateQuestionsList(quizId, totalIndex, { content: clonContent }); }; useEffect(() => { const isTypeSetted = DESIGN_TYPES.find(({ value }) => value === listQuestions[quizId][totalIndex].content.type); if (!isTypeSetted) { const clonContent = listQuestions[quizId][totalIndex].content; clonContent.type = DESIGN_TYPES[0].value; updateQuestionsList(quizId, totalIndex, { content: clonContent }); } }, []); return ( <> Пользователь может загрузить любой собственный файл ); }