dify/web/app/components/workflow/header/scroll-to-selected-node-button.tsx
Stephen Zhou a84c2d36a3
style: format with vp fmt (#38803)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-12 15:57:46 +00:00

28 lines
1021 B
TypeScript

import type { FC } from 'react'
import type { CommonNodeType } from '../types'
import { cn } from '@langgenius/dify-ui/cn'
import { useTranslation } from 'react-i18next'
import { useNodes } from 'reactflow'
import { scrollToWorkflowNode } from '../utils/node-navigation'
const ScrollToSelectedNodeButton: FC = () => {
const { t } = useTranslation()
const nodes = useNodes<CommonNodeType>()
const selectedNode = nodes.find((node) => node.data.selected)
if (!selectedNode) return null
return (
<div
className={cn(
'flex h-6 cursor-pointer items-center justify-center rounded-md border-[0.5px] border-effects-highlight bg-components-actionbar-bg px-3 system-xs-medium whitespace-nowrap text-text-tertiary shadow-lg backdrop-blur-xs transition-colors duration-200 hover:text-text-accent',
)}
onClick={() => scrollToWorkflowNode(selectedNode.id)}
>
{t(($) => $['panel.scrollToSelectedNode'], { ns: 'workflow' })}
</div>
)
}
export default ScrollToSelectedNodeButton