From 768bfa8a7e579d456bf5251f7b1e3ed425e854b1 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 6 Feb 2026 14:41:47 +0800 Subject: [PATCH] chore: hover show tool icon --- .../plugins/tool-block/component.tsx | 28 +++++++++++++--- .../tool-block/tool-group-block-component.tsx | 32 +++++++++++++++++-- 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/component.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/component.tsx index 18b0f82e30..3074269f4c 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/component.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/component.tsx @@ -4,7 +4,7 @@ import type { ToolValue } from '@/app/components/workflow/block-selector/types' import type { ToolWithProvider } from '@/app/components/workflow/types' import type { AppAssetTreeView } from '@/types/app-asset' import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext' -import { RiAlertFill } from '@remixicon/react' +import { RiAlertFill, RiEqualizer2Line } from '@remixicon/react' import * as React from 'react' import { useEffect, useMemo, useState } from 'react' import { createPortal } from 'react-dom' @@ -358,11 +358,31 @@ const ToolBlockComponent = ({ /> ) })() + const hoverIcon = ( + + ) + const normalIcon = ( + + {iconNode} + + ) + const iconContent = ( + + {normalIcon} + {isInteractive && hoverIcon} + + ) if (!needAuthorization) - return iconNode + return iconContent return ( - {iconNode} + {iconContent} ) } @@ -521,7 +541,7 @@ const ToolBlockComponent = ({ { + const [editor] = useLexicalComposerContext() const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_TOOL_BLOCK_COMMAND) const { t } = useTranslation() const authBadgeLabel = t('skillEditor.authorizationBadge', { ns: 'workflow' }) @@ -113,6 +115,7 @@ const ToolGroupBlockComponent = ({ const toolBlockContext = useToolBlockContext() const isUsingExternalMetadata = Boolean(toolBlockContext?.onMetadataChange) const useModal = Boolean(toolBlockContext?.useModal) + const isInteractive = editor.isEditable() const [isSettingOpen, setIsSettingOpen] = useState(false) const [portalContainer, setPortalContainer] = useState(null) const [expandedToolId, setExpandedToolId] = useState(null) @@ -535,11 +538,31 @@ const ToolGroupBlockComponent = ({ /> ) })() + const hoverIcon = ( + + ) + const normalIcon = ( + + {iconNode} + + ) + const iconContent = ( + + {normalIcon} + {isInteractive && hoverIcon} + + ) if (!needAuthorization) - return iconNode + return iconContent return ( - {iconNode} + {iconContent} ) } @@ -779,12 +802,15 @@ const ToolGroupBlockComponent = ({ { + if (!isInteractive) + return if (!toolItems.length) return setIsSettingOpen(true)