'use client'; import { Handle, Position } from 'reactflow'; import { IconConsolidation, IconRSForm } from '@/components/Icons'; import TooltipOperation from '@/components/info/TooltipOperation'; import MiniButton from '@/components/ui/MiniButton.tsx'; import Overlay from '@/components/ui/Overlay'; import { OssNodeInternal } from '@/models/miscellaneous'; import { PARAMETER, prefixes } from '@/utils/constants'; import { truncateToLastWord } from '@/utils/utils'; import { useOssEdit } from '../OssEditContext'; function OperationNode(node: OssNodeInternal) { const controller = useOssEdit(); const hasFile = !!node.data.operation.result; const longLabel = node.data.label.length > PARAMETER.ossLongLabel; const labelText = truncateToLastWord(node.data.label, PARAMETER.ossTruncateLabel); const handleOpenSchema = () => { controller.openOperationSchema(Number(node.id)); }; return ( <> } noHover noPadding title={hasFile ? 'Связанная КС' : 'Нет связанной КС'} hideTitle={!controller.showTooltip} onClick={handleOpenSchema} disabled={!hasFile} /> {node.data.operation.is_consolidation ? ( } disabled noPadding noHover titleHtml='Внимание!
Ромбовидный синтез
Возможны дубликаты конституент' hideTitle={!controller.showTooltip} /> ) : null}
{!node.data.operation.is_owned ? (
) : null}
{labelText}
{controller.showTooltip && !node.dragging ? ( ) : null}
); } export default OperationNode;