dify/web/app/components/workflow/panel/index.tsx
zxhlyh efe5db38ee
Some checks are pending
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Waiting to run
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Blocked by required conditions
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Blocked by required conditions
Chore/slice workflow (#18351)
2025-04-18 13:59:12 +08:00

51 lines
1.1 KiB
TypeScript

import type { FC } from 'react'
import { memo } from 'react'
import { useNodes } from 'reactflow'
import type { CommonNodeType } from '../types'
import { Panel as NodePanel } from '../nodes'
import { useStore } from '../store'
import EnvPanel from './env-panel'
import cn from '@/utils/classnames'
export type PanelProps = {
components?: {
left?: React.ReactNode
right?: React.ReactNode
}
}
const Panel: FC<PanelProps> = ({
components,
}) => {
const nodes = useNodes<CommonNodeType>()
const selectedNode = nodes.find(node => node.data.selected)
const showEnvPanel = useStore(s => s.showEnvPanel)
const isRestoring = useStore(s => s.isRestoring)
return (
<div
tabIndex={-1}
className={cn('absolute bottom-2 right-0 top-14 z-10 flex outline-none')}
key={`${isRestoring}`}
>
{
components?.left
}
{
!!selectedNode && (
<NodePanel {...selectedNode!} />
)
}
{
components?.right
}
{
showEnvPanel && (
<EnvPanel />
)
}
</div>
)
}
export default memo(Panel)