import type { MouseEvent } from 'react' import { cn } from '@langgenius/dify-ui/cn' import { RiCursorLine, RiFunctionAddLine, RiHand, RiStickyNoteAddLine, } from '@remixicon/react' import { memo, } from 'react' import { useTranslation } from 'react-i18next' import { Comment } from '@/app/components/base/icons/src/public/other' import Divider from '../../base/divider' import { useNodesReadOnly, useWorkflowMoveMode, useWorkflowOrganize, } from '../hooks' import { useStore } from '../store' import { ControlMode, } from '../types' import AddBlock from './add-block' import { useOperator } from './hooks' import MoreActions from './more-actions' import TipPopup from './tip-popup' const Control = () => { const { t } = useTranslation() const controlMode = useStore(s => s.controlMode) const { handleModePointer, handleModeHand, handleModeComment, isCommentModeAvailable, canUseCommentMode, } = useWorkflowMoveMode() const { handleLayout } = useWorkflowOrganize() const { handleAddNote } = useOperator() const { nodesReadOnly, getNodesReadOnly, } = useNodesReadOnly() const addNote = (e: MouseEvent) => { if (getNodesReadOnly()) return e.stopPropagation() handleAddNote() } return (
$['nodes.note.addNote'], { ns: 'workflow' })}> $['common.pointerMode'], { ns: 'workflow' })} shortcut="workflow.pointer-mode"> $['common.handMode'], { ns: 'workflow' })} shortcut="workflow.hand-mode"> {isCommentModeAvailable && ( $['common.commentMode'], { ns: 'workflow' })} shortcut="workflow.comment-mode"> )} $['panel.organizeBlocks'], { ns: 'workflow' })} shortcut="workflow.organize">
) } export default memo(Control)