feat: workflow interaction (#4214)

This commit is contained in:
zxhlyh
2024-05-09 17:18:51 +08:00
committed by GitHub
parent 487ce7c82a
commit 9b24f12bf5
54 changed files with 1955 additions and 431 deletions

View File

@@ -1,54 +1,23 @@
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
import { MiniMap } from 'reactflow'
import {
useNodesReadOnly,
useWorkflow,
} from '../hooks'
import ZoomInOut from './zoom-in-out'
import { OrganizeGrid } from '@/app/components/base/icons/src/vender/line/layout'
import TooltipPlus from '@/app/components/base/tooltip-plus'
import Control from './control'
const Operator = () => {
const { t } = useTranslation()
const { handleLayout } = useWorkflow()
const {
nodesReadOnly,
getNodesReadOnly,
} = useNodesReadOnly()
const goLayout = () => {
if (getNodesReadOnly())
return
handleLayout()
}
return (
<div className={`
absolute left-6 bottom-6 z-[9]
`}>
<>
<MiniMap
style={{
width: 128,
height: 80,
width: 102,
height: 72,
}}
className='!static !m-0 !w-[128px] !h-[80px] !border-[0.5px] !border-black/[0.08] !rounded-lg !shadow-lg'
className='!absolute !left-4 !bottom-14 z-[9] !m-0 !w-[102px] !h-[72px] !border-[0.5px] !border-black/[0.08] !rounded-lg !shadow-lg'
/>
<div className='flex items-center mt-1 p-0.5 rounded-lg border-[0.5px] border-gray-100 bg-white shadow-lg text-gray-500'>
<div className='flex items-center mt-1 gap-2 absolute left-4 bottom-4 z-[9]'>
<ZoomInOut />
<TooltipPlus popupContent={t('workflow.panel.organizeBlocks')}>
<div
className={`
ml-[1px] flex items-center justify-center w-8 h-8 cursor-pointer hover:bg-black/5 rounded-lg
${nodesReadOnly && '!cursor-not-allowed opacity-50'}
`}
onClick={goLayout}
>
<OrganizeGrid className='w-4 h-4' />
</div>
</TooltipPlus>
<Control />
</div>
</div>
</>
)
}