import React, { FC, ReactNode } from "react"; import { IconEdit } from "@tabler/icons-react"; import { motion } from "framer-motion"; import { Box, Tabs, Text } from "@mantine/core"; import GeneralTab from "@/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab"; import useIsMobile from "@/hooks/utils/useIsMobile"; import { DealSchema, ProjectSchema } from "@/lib/client"; import { MODULES } from "@/modules/modules"; import styles from "../DealEditorDrawer.module.css"; type Props = { value: DealSchema; onChange: (deal: DealSchema) => void; onDelete: (deal: DealSchema) => void; project: ProjectSchema | null; }; const DealEditorBody: FC = props => { const isMobile = useIsMobile(); const getTabPanel = (value: string, component: ReactNode): ReactNode => ( {component} ); const getModuleTabs = () => props.project?.builtInModules.map(module => { const moduleRender = MODULES[module.key].renderInfo; return ( {moduleRender.label} ); }); const getModuleTabPanels = () => props.project?.builtInModules.map(module => getTabPanel(module.key, MODULES[module.key]?.getTab?.(props)) ); return ( }> Общая информация {getModuleTabs()} {getTabPanel("general", )} {getModuleTabPanels()} ); }; export default DealEditorBody;