import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { IModalProps } from '@/interfaces/common'; import { useIsPipeline } from '@/pages/agent/hooks/use-is-pipeline'; import { t } from 'i18next'; import { PropsWithChildren, memo, useEffect, useRef } from 'react'; import { AccordionOperators, PipelineAccordionOperators, } from './accordion-operators'; import { HideModalContext, OnNodeCreatedContext } from './operator-item-list'; export function InnerNextStepDropdown({ children, hideModal, position, onNodeCreated, nodeId, }: PropsWithChildren & IModalProps & { position?: { x: number; y: number }; onNodeCreated?: (newNodeId: string) => void; nodeId?: string; }) { const dropdownRef = useRef(null); const isPipeline = useIsPipeline(); useEffect(() => { if (position && hideModal) { const handleKeyDown = (event: KeyboardEvent) => { if (event.key === 'Escape') { hideModal(); } }; document.addEventListener('keydown', handleKeyDown); return () => { document.removeEventListener('keydown', handleKeyDown); }; } }, [position, hideModal]); if (position) { return (
e.stopPropagation()} >
{t('flow.nextStep')}
{isPipeline ? ( ) : ( )}
); } return ( { if (!open && hideModal) { hideModal(); } }} > {children} e.stopPropagation()} className="w-[300px] font-semibold" > {t('flow.nextStep')} {isPipeline ? ( ) : ( )} ); } export const NextStepDropdown = memo(InnerNextStepDropdown);