import { Box, Button, Paper, Typography, Menu, MenuItem, TextField, } from "@mui/material"; import { BackButton, createSightStore, languageStore, TabPanel } from "@shared"; import { LanguageSwitcher, ReactMarkdownComponent, ReactMarkdownEditor, } from "@widgets"; import { ImagePlus, Plus } from "lucide-react"; import { observer } from "mobx-react-lite"; import { useState } from "react"; // --- RightWidgetTab (Parent) Component --- export const CreateRightTab = observer( ({ value, index }: { value: number; index: number }) => { const [anchorEl, setAnchorEl] = useState(null); const { sight, createNewRightArticle, updateRightArticleInfo } = createSightStore; const { language } = languageStore; const [activeArticleIndex, setActiveArticleIndex] = useState( null ); const open = Boolean(anchorEl); const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; const handleSave = () => { console.log("Saving right widget..."); }; const handleSelectArticle = (index: number) => { setActiveArticleIndex(index); }; return ( { // setMediaType("preview"); }} className="w-full bg-gray-200 p-4 rounded-2xl cursor-pointer text-sm hover:bg-gray-300 transition-all duration-300" > Предпросмотр медиа {sight[language].right.map((article, index) => ( { handleSelectArticle(index); }} > {article.heading} ))} { createNewRightArticle(); handleClose(); }} > Создать новую { handleClose(); }} > Выбрать существующую статью {activeArticleIndex !== null && ( <> {/* Левая колонка: Редактирование */} updateRightArticleInfo( activeArticleIndex, language, e.target.value, sight[language].right[activeArticleIndex].body ) } variant="outlined" fullWidth /> updateRightArticleInfo( activeArticleIndex, language, sight[language].right[activeArticleIndex] .heading, value ) } /> {/* Блок МЕДИА для статьи */} {/* МЕДИА {data.left.media ? ( Selected media ) : ( Нет медиа )} {data.left.media && ( )} */} )} {activeArticleIndex !== null && ( {false ? ( Загрузка... ) : ( <> {sight[language].right[activeArticleIndex] .heading || "Выберите статью"} {sight[language].right[activeArticleIndex].body ? ( ) : ( Предпросмотр статьи появится здесь )} )} )} {/* */} ); } );