import React, { useState } from 'react'; import { useDrag } from 'react-dnd'; import Block from './Block'; import Connection from './Connection'; const Toolbar = ({ onAddBlock }) => { //состояние для активной вкладки const [activeTab, setActiveTab] = useState('logical'); const blockCategories = { logical: [ { type: 'AND', label: 'AND' }, { type: 'OR', label: 'OR' }, { type: 'NOT', label: 'NOT' }, { type: 'XOR', label: 'XOR' } ], arithmetic: [ { type: 'ADD', label: 'ADD' }, { type: 'SUB', label: 'SUB' }, { type: 'MUL', label: 'MUL' }, { type: 'DIV', label: 'DIV' } ], timers: [ { type: 'TON', label: 'TON' }, { type: 'TOF', label: 'TOF' }, { type: 'TP', label: 'TP' } ], counters: [ { type: 'CTU', label: 'CTU' }, { type: 'CTD', label: 'CTD' }, { type: 'CTUD', label: 'CTUD' } ], comparisons: [ { type: 'GT', label: 'GT' }, { type: 'LT', label: 'LT' }, { type: 'EQ', label: 'EQ' } ], other: [ { type: 'SR', label: 'SR' }, { type: 'RS', label: 'RS' }, { type: 'MOVE', label: 'MOVE' } ], customized: [] }; const activeBlocks = blockCategories[activeTab] || []; return (