import { FC, useState } from "react"; import { ItemsSelectionView } from "./ItemsSelectionView/ItemsSelectionView"; import { ItemDetailsView } from "./ItemDetailsView/ItemDetailsView"; import { Box } from "@mui/material"; import { QuestionKeys, SelectedQuestions, TagKeys, TagQuestionHC } from "../types"; import { EntitiesQuestions } from "./EntitiesQuestions"; type MinifiedData = { id: string; title: string; subTitle?: string; }; type Props = { questionsItems: MinifiedData[] | []; selectedQuestions: SelectedQuestions; handleAddQuestion: (scope: QuestionKeys | TagKeys, id: string, type: "question" | "tag") => void; openDelete: (data: TagQuestionHC) => void; handlePrevStep: () => void; handleNextStep: () => void; }; export const AmoQuestions: FC = ({ questionsItems, selectedQuestions, handleAddQuestion, handlePrevStep, handleNextStep, openDelete, }) => { const [isSelection, setIsSelection] = useState(false); const [activeScope, setActiveScope] = useState(null); const [selectedQuestion, setSelectedQuestion] = useState(null); const handleAdd = () => { if (activeScope === null || selectedQuestion === null) return; setActiveScope(null); handleAddQuestion(activeScope, selectedQuestion, "question"); }; const handleDelete = (id: string, scope: QuestionKeys) => { openDelete({ id, scope, type: "question", }); }; return ( {isSelection && activeScope !== null ? ( { setActiveScope(null); setIsSelection(false); }} onLargeBtnClick={() => { handleAdd(); setActiveScope(null); setIsSelection(false); }} /> // Здесь выбираем элемент в табличку // { // setActiveScope(null); // setIsSelection(false); // }} // onLargeBtnClick={() => { // handleAdd(); // setActiveScope(null); // setIsSelection(false); // }} // /> ) : ( // Табличка )} ); };