From 8326b9e3e5294de9b95bce503a5ecd351f18cc0c Mon Sep 17 00:00:00 2001 From: yyh Date: Wed, 28 Jan 2026 23:34:08 +0800 Subject: [PATCH] refactor(skill): remove React.FC type annotations from all components Replace FC pattern with direct props typing in function parameters for better TypeScript inference and modern React best practices. --- web/app/components/workflow/skill/content-area.tsx | 4 ++-- web/app/components/workflow/skill/content-body.tsx | 4 ++-- .../workflow/skill/editor/code-file-editor.tsx | 3 +-- .../workflow/skill/editor/markdown-file-editor.tsx | 5 ++--- .../workflow/skill/editor/skill-editor/index.tsx | 5 ++--- .../skill-editor/plugins/file-picker-block.tsx | 3 +-- .../skill-editor/plugins/file-picker-panel.tsx | 7 +++---- .../plugins/file-reference-block/component.tsx | 3 +-- .../skill-editor/plugins/remote-cursors/index.tsx | 13 ++++++++----- .../skill-editor/plugins/tool-block/component.tsx | 5 ++--- .../tool-block/tool-group-block-component.tsx | 5 ++--- .../skill-editor/plugins/tool-block/tool-header.tsx | 5 ++--- .../plugins/tool-block/tool-picker-block.tsx | 3 +-- .../tool-setting/tool-settings-section.tsx | 5 ++--- .../workflow/skill/file-content-panel.tsx | 3 +-- web/app/components/workflow/skill/file-tab-item.tsx | 5 ++--- web/app/components/workflow/skill/file-tabs.tsx | 3 +-- .../workflow/skill/file-tree/artifacts-section.tsx | 3 +-- .../workflow/skill/file-tree/artifacts-tree.tsx | 9 ++++----- .../skill/file-tree/drag-action-tooltip.tsx | 3 +-- .../components/workflow/skill/file-tree/index.tsx | 2 +- .../workflow/skill/file-tree/menu-item.tsx | 3 +-- .../workflow/skill/file-tree/node-menu.tsx | 5 ++--- .../workflow/skill/file-tree/tree-context-menu.tsx | 3 +-- .../workflow/skill/file-tree/tree-edit-input.tsx | 2 +- .../workflow/skill/file-tree/tree-guide-lines.tsx | 4 ++-- .../workflow/skill/file-tree/tree-node-icon.tsx | 5 ++--- .../skill/file-tree/upload-status-tooltip.tsx | 4 ++-- web/app/components/workflow/skill/main.tsx | 5 ++--- .../workflow/skill/sidebar-search-add.tsx | 5 ++--- web/app/components/workflow/skill/sidebar.tsx | 4 ++-- .../components/workflow/skill/skill-page-layout.tsx | 4 ++-- .../components/workflow/skill/start-tab-item.tsx | 5 ++--- .../workflow/skill/start-tab/action-card.tsx | 6 +++--- .../skill/start-tab/category-tabs/index.tsx | 5 ++--- .../skill/start-tab/category-tabs/tab-item.tsx | 5 ++--- .../skill/start-tab/create-import-section.tsx | 3 +-- .../components/workflow/skill/start-tab/index.tsx | 3 +-- .../workflow/skill/start-tab/section-header.tsx | 5 ++--- .../skill/start-tab/skill-templates-section.tsx | 3 +-- .../workflow/skill/start-tab/template-search.tsx | 5 ++--- .../workflow/skill/viewer/media-file-preview.tsx | 3 +-- .../skill/viewer/sqlite-file-preview/data-table.tsx | 4 ++-- .../skill/viewer/sqlite-file-preview/index.tsx | 5 ++--- .../viewer/sqlite-file-preview/table-panel.tsx | 6 +++--- .../viewer/sqlite-file-preview/table-selector.tsx | 5 ++--- .../skill/viewer/unsupported-file-download.tsx | 3 +-- 47 files changed, 88 insertions(+), 120 deletions(-) diff --git a/web/app/components/workflow/skill/content-area.tsx b/web/app/components/workflow/skill/content-area.tsx index f6347944b9..d72f7683d8 100644 --- a/web/app/components/workflow/skill/content-area.tsx +++ b/web/app/components/workflow/skill/content-area.tsx @@ -1,9 +1,9 @@ -import type { FC, PropsWithChildren } from 'react' +import type { PropsWithChildren } from 'react' import * as React from 'react' type ContentAreaProps = PropsWithChildren -const ContentArea: FC = ({ children }) => { +const ContentArea = ({ children }: ContentAreaProps) => { return (
{children} diff --git a/web/app/components/workflow/skill/content-body.tsx b/web/app/components/workflow/skill/content-body.tsx index 51a066766e..8ba6154a5e 100644 --- a/web/app/components/workflow/skill/content-body.tsx +++ b/web/app/components/workflow/skill/content-body.tsx @@ -1,9 +1,9 @@ -import type { FC, PropsWithChildren } from 'react' +import type { PropsWithChildren } from 'react' import * as React from 'react' type ContentBodyProps = PropsWithChildren -const ContentBody: FC = ({ children }) => { +const ContentBody = ({ children }: ContentBodyProps) => { return (
{children} diff --git a/web/app/components/workflow/skill/editor/code-file-editor.tsx b/web/app/components/workflow/skill/editor/code-file-editor.tsx index 650d6d13f9..5ad2d0b467 100644 --- a/web/app/components/workflow/skill/editor/code-file-editor.tsx +++ b/web/app/components/workflow/skill/editor/code-file-editor.tsx @@ -1,4 +1,3 @@ -import type { FC } from 'react' import Editor from '@monaco-editor/react' import * as React from 'react' import Loading from '@/app/components/base/loading' @@ -11,7 +10,7 @@ type CodeFileEditorProps = { onMount: (editor: any, monaco: any) => void } -const CodeFileEditor: FC = ({ language, theme, value, onChange, onMount }) => { +const CodeFileEditor = ({ language, theme, value, onChange, onMount }: CodeFileEditorProps) => { return ( = ({ +const MarkdownFileEditor = ({ instanceId, value, onChange, collaborationEnabled, -}) => { +}: MarkdownFileEditorProps) => { const { t } = useTranslation() const handleChange = React.useCallback((val: string) => { if (val !== value) { diff --git a/web/app/components/workflow/skill/editor/skill-editor/index.tsx b/web/app/components/workflow/skill/editor/skill-editor/index.tsx index 6f24601a5e..32768bada3 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/index.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/index.tsx @@ -1,7 +1,6 @@ 'use client' import type { EditorState } from 'lexical' -import type { FC } from 'react' import { CodeNode } from '@lexical/code' import { LexicalComposer } from '@lexical/react/LexicalComposer' import { ContentEditable } from '@lexical/react/LexicalContentEditable' @@ -52,7 +51,7 @@ export type SkillEditorProps = { toolPickerScope?: string } -const SkillEditor: FC = ({ +const SkillEditor = ({ instanceId, compact, wrapperClassName, @@ -68,7 +67,7 @@ const SkillEditor: FC = ({ onBlur, onFocus, toolPickerScope = 'all', -}) => { +}: SkillEditorProps) => { const initialConfig = { namespace: 'skill-editor', nodes: [ diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-picker-block.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-picker-block.tsx index 4aabcec1cc..c8216141f1 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-picker-block.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-picker-block.tsx @@ -1,5 +1,4 @@ import type { LexicalNode } from 'lexical' -import type { FC } from 'react' import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext' import { LexicalTypeaheadMenuPlugin, MenuOption } from '@lexical/react/LexicalTypeaheadMenuPlugin' import { @@ -24,7 +23,7 @@ class FilePickerMenuOption extends MenuOption { } } -const FilePickerBlock: FC = () => { +const FilePickerBlock = () => { const [editor] = useLexicalComposerContext() const checkForTriggerMatch = useBasicTypeaheadTriggerMatch('/', { minLength: 0, diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-picker-panel.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-picker-panel.tsx index 5ef3df27e2..bc19b18c0c 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-picker-panel.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-picker-panel.tsx @@ -1,4 +1,3 @@ -import type { FC } from 'react' import type { NodeRendererProps } from 'react-arborist' import type { FileAppearanceType } from '@/app/components/base/file-uploader/types' import type { TreeNodeData } from '@/app/components/workflow/skill/type' @@ -20,7 +19,7 @@ type FilePickerTreeNodeProps = NodeRendererProps & { onSelectNode: (node: TreeNodeData) => void } -const FilePickerTreeNode: FC = ({ node, style, dragHandle, onSelectNode }) => { +const FilePickerTreeNode = ({ node, style, dragHandle, onSelectNode }: FilePickerTreeNodeProps) => { const { t } = useTranslation('workflow') const isFolder = node.data.node_type === 'folder' const isSelected = node.isSelected @@ -114,13 +113,13 @@ type FilePickerPanelProps = { showHeader?: boolean } -const FilePickerPanel: FC = ({ +const FilePickerPanel = ({ onSelectNode, focusNodeId, className, contentClassName, showHeader = true, -}) => { +}: FilePickerPanelProps) => { const { t } = useTranslation('workflow') const { data: treeData, isLoading, error } = useSkillAssetTreeData() const containerRef = useRef(null) diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/component.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/component.tsx index fa01f15fb1..aca2f34ddd 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/component.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/component.tsx @@ -1,5 +1,4 @@ import type { LexicalNode } from 'lexical' -import type { FC } from 'react' import type { FileAppearanceType } from '@/app/components/base/file-uploader/types' import type { TreeNodeData } from '@/app/components/workflow/skill/type' import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext' @@ -24,7 +23,7 @@ type FileReferenceBlockProps = { resourceId: string } -const FileReferenceBlock: FC = ({ nodeKey, resourceId }) => { +const FileReferenceBlock = ({ nodeKey, resourceId }: FileReferenceBlockProps) => { const [editor] = useLexicalComposerContext() const [ref, isSelected] = useSelectOrDelete(nodeKey) const { data: nodeMap } = useSkillAssetNodeMap() diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/remote-cursors/index.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/remote-cursors/index.tsx index 77d2571525..96b1516171 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/remote-cursors/index.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/remote-cursors/index.tsx @@ -1,6 +1,5 @@ 'use client' import type { RangeSelection, TextNode } from 'lexical' -import type { FC } from 'react' import type { OnlineUser } from '@/app/components/workflow/collaboration/types' import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext' import { @@ -316,10 +315,12 @@ const getSelectionRects = ( return rects } -export const LocalCursorPlugin: FC<{ +type LocalCursorPluginProps = { fileId?: string enabled?: boolean -}> = ({ fileId, enabled }) => { +} + +export const LocalCursorPlugin = ({ fileId, enabled }: LocalCursorPluginProps) => { const [editor] = useLexicalComposerContext() const lastEmittedCursorRef = useRef<{ start: number, end: number } | null>(null) const lastEmitRef = useRef(0) @@ -461,10 +462,12 @@ export const LocalCursorPlugin: FC<{ return null } -export const SkillRemoteCursors: FC<{ +type SkillRemoteCursorsProps = { fileId?: string enabled?: boolean -}> = ({ fileId, enabled }) => { +} + +export const SkillRemoteCursors = ({ fileId, enabled }: SkillRemoteCursorsProps) => { const [editor] = useLexicalComposerContext() const { userProfile } = useAppContext() const myUserId = userProfile?.id || null 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 fbda9c99ec..e2991c9cba 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 @@ -1,4 +1,3 @@ -import type { FC } from 'react' import type { PluginDetail } from '@/app/components/plugins/types' import type { Emoji } from '@/app/components/tools/types' import type { ToolValue } from '@/app/components/workflow/block-selector/types' @@ -107,7 +106,7 @@ type ToolConfigValueItem = { type ToolConfigValueMap = Record -const ToolBlockComponent: FC = ({ +const ToolBlockComponent = ({ nodeKey, provider, tool, @@ -115,7 +114,7 @@ const ToolBlockComponent: FC = ({ label, icon, iconDark, -}) => { +}: ToolBlockComponentProps) => { const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_TOOL_BLOCK_COMMAND) const language = useGetLanguage() const { t } = useTranslation() diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-group-block-component.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-group-block-component.tsx index 1f1eb3f2ae..61e83af2ad 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-group-block-component.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-group-block-component.tsx @@ -1,4 +1,3 @@ -import type { FC } from 'react' import type { ToolToken } from './utils' import type { PluginDetail } from '@/app/components/plugins/types' import type { ToolParameter } from '@/app/components/tools/types' @@ -102,10 +101,10 @@ const normalizeProviderIcon = (icon?: ToolWithProvider['icon']) => { return icon } -const ToolGroupBlockComponent: FC = ({ +const ToolGroupBlockComponent = ({ nodeKey, tools, -}) => { +}: ToolGroupBlockComponentProps) => { const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_TOOL_BLOCK_COMMAND) const { t } = useTranslation() const authBadgeLabel = t('skillEditor.authorizationBadge', { ns: 'workflow' }) diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-header.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-header.tsx index 6c6f671307..5e38957dc9 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-header.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-header.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import type { Emoji } from '@/app/components/tools/types' import { RiArrowLeftSLine, RiCloseLine } from '@remixicon/react' import AppIcon from '@/app/components/base/app-icon' @@ -15,7 +14,7 @@ type ToolHeaderProps = { backLabel?: string } -const ToolHeader: FC = ({ +const ToolHeader = ({ icon, providerLabel, toolLabel, @@ -23,7 +22,7 @@ const ToolHeader: FC = ({ onClose, onBack, backLabel, -}) => { +}: ToolHeaderProps) => { const renderHeaderIcon = () => { if (!icon) return null diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-picker-block.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-picker-block.tsx index c1ad1b3579..1784503c97 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-picker-block.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/tool-picker-block.tsx @@ -1,5 +1,4 @@ import type { LexicalNode } from 'lexical' -import type { FC } from 'react' import type { ToolParameter } from '@/app/components/tools/types' import type { ToolDefaultValue } from '@/app/components/workflow/block-selector/types' import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext' @@ -32,7 +31,7 @@ type ToolPickerBlockProps = { scope?: string } -const ToolPickerBlock: FC = ({ scope = 'all' }) => { +const ToolPickerBlock = ({ scope = 'all' }: ToolPickerBlockProps) => { const [editor] = useLexicalComposerContext() const checkForTriggerMatch = useBasicTypeaheadTriggerMatch('@', { minLength: 0, diff --git a/web/app/components/workflow/skill/editor/skill-editor/tool-setting/tool-settings-section.tsx b/web/app/components/workflow/skill/editor/skill-editor/tool-setting/tool-settings-section.tsx index 2328825877..b0a4399b93 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/tool-setting/tool-settings-section.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/tool-setting/tool-settings-section.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import type { Tool } from '@/app/components/tools/types' import type { ToolValue } from '@/app/components/workflow/block-selector/types' import type { ToolWithProvider } from '@/app/components/workflow/types' @@ -38,13 +37,13 @@ type ToolSettingsSectionProps = { onChange?: (value: ToolValue) => void } -const ToolSettingsSection: FC = ({ +const ToolSettingsSection = ({ currentProvider, currentTool, value, nodeId, onChange, -}) => { +}: ToolSettingsSectionProps) => { const { t } = useTranslation() const safeNodeId = nodeId ?? '' diff --git a/web/app/components/workflow/skill/file-content-panel.tsx b/web/app/components/workflow/skill/file-content-panel.tsx index 8ec7a81735..b530830abb 100644 --- a/web/app/components/workflow/skill/file-content-panel.tsx +++ b/web/app/components/workflow/skill/file-content-panel.tsx @@ -1,7 +1,6 @@ 'use client' import type { OnMount } from '@monaco-editor/react' -import type { FC } from 'react' import { loader } from '@monaco-editor/react' import dynamic from 'next/dynamic' import * as React from 'react' @@ -34,7 +33,7 @@ const SQLiteFilePreview = dynamic( if (typeof window !== 'undefined') loader.config({ paths: { vs: `${window.location.origin}${basePath}/vs` } }) -const FileContentPanel: FC = () => { +const FileContentPanel = () => { const { t } = useTranslation('workflow') const { theme: appTheme } = useTheme() const [isMounted, setIsMounted] = useState(false) diff --git a/web/app/components/workflow/skill/file-tab-item.tsx b/web/app/components/workflow/skill/file-tab-item.tsx index 601e687410..d9c6fc37eb 100644 --- a/web/app/components/workflow/skill/file-tab-item.tsx +++ b/web/app/components/workflow/skill/file-tab-item.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import type { FileAppearanceType } from '@/app/components/base/file-uploader/types' import { RiCloseLine } from '@remixicon/react' import * as React from 'react' @@ -22,7 +21,7 @@ type FileTabItemProps = { onDoubleClick: (fileId: string) => void } -const FileTabItem: FC = ({ +const FileTabItem = ({ fileId, name, extension, @@ -32,7 +31,7 @@ const FileTabItem: FC = ({ onClick, onClose, onDoubleClick, -}) => { +}: FileTabItemProps) => { const { t } = useTranslation() const iconType = getFileIconType(name, extension) diff --git a/web/app/components/workflow/skill/file-tabs.tsx b/web/app/components/workflow/skill/file-tabs.tsx index b84be06a88..32b8bc622b 100644 --- a/web/app/components/workflow/skill/file-tabs.tsx +++ b/web/app/components/workflow/skill/file-tabs.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import * as React from 'react' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' @@ -12,7 +11,7 @@ import FileTabItem from './file-tab-item' import { useSkillAssetNodeMap } from './hooks/use-skill-asset-tree' import StartTabItem from './start-tab-item' -const FileTabs: FC = () => { +const FileTabs = () => { const { t } = useTranslation('workflow') const openTabIds = useStore(s => s.openTabIds) const activeTabId = useStore(s => s.activeTabId) diff --git a/web/app/components/workflow/skill/file-tree/artifacts-section.tsx b/web/app/components/workflow/skill/file-tree/artifacts-section.tsx index e19004c92a..2c2100f5fa 100644 --- a/web/app/components/workflow/skill/file-tree/artifacts-section.tsx +++ b/web/app/components/workflow/skill/file-tree/artifacts-section.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import type { SandboxFileTreeNode } from '@/types/sandbox-file' import { RiArrowDownSLine, RiArrowRightSLine, RiLoader2Line } from '@remixicon/react' import * as React from 'react' @@ -16,7 +15,7 @@ type ArtifactsSectionProps = { className?: string } -const ArtifactsSection: FC = ({ className }) => { +const ArtifactsSection = ({ className }: ArtifactsSectionProps) => { const { t } = useTranslation('workflow') const { userProfile } = useAppContext() const sandboxId = userProfile?.id diff --git a/web/app/components/workflow/skill/file-tree/artifacts-tree.tsx b/web/app/components/workflow/skill/file-tree/artifacts-tree.tsx index d84621c52b..b363affa89 100644 --- a/web/app/components/workflow/skill/file-tree/artifacts-tree.tsx +++ b/web/app/components/workflow/skill/file-tree/artifacts-tree.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import type { FileAppearanceType } from '@/app/components/base/file-uploader/types' import type { SandboxFileTreeNode } from '@/types/sandbox-file' import { RiDownloadLine, RiFolderLine, RiFolderOpenLine } from '@remixicon/react' @@ -30,14 +29,14 @@ type ArtifactsTreeNodeProps = { isDownloading?: boolean } -const ArtifactsTreeNode: FC = ({ +const ArtifactsTreeNode = ({ node, depth, onDownload, onSelect, selectedPath, isDownloading, -}) => { +}: ArtifactsTreeNodeProps) => { const [isExpanded, setIsExpanded] = useState(false) const isFolder = node.node_type === 'folder' const hasChildren = isFolder && node.children.length > 0 @@ -132,13 +131,13 @@ const ArtifactsTreeNode: FC = ({ ) } -const ArtifactsTree: FC = ({ +const ArtifactsTree = ({ data, onDownload, onSelect, selectedPath, isDownloading, -}) => { +}: ArtifactsTreeProps) => { if (!data || data.length === 0) return null diff --git a/web/app/components/workflow/skill/file-tree/drag-action-tooltip.tsx b/web/app/components/workflow/skill/file-tree/drag-action-tooltip.tsx index 9b5f20f82b..cab0c3c33f 100644 --- a/web/app/components/workflow/skill/file-tree/drag-action-tooltip.tsx +++ b/web/app/components/workflow/skill/file-tree/drag-action-tooltip.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import * as React from 'react' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' @@ -14,7 +13,7 @@ type DragActionTooltipProps = { action: DragAction } -const DragActionTooltip: FC = ({ action }) => { +const DragActionTooltip = ({ action }: DragActionTooltipProps) => { const { t } = useTranslation('workflow') const dragOverFolderId = useStore(s => s.dragOverFolderId) const { data: nodeMap } = useSkillAssetNodeMap() diff --git a/web/app/components/workflow/skill/file-tree/index.tsx b/web/app/components/workflow/skill/file-tree/index.tsx index 5bef103e35..f2f8325468 100644 --- a/web/app/components/workflow/skill/file-tree/index.tsx +++ b/web/app/components/workflow/skill/file-tree/index.tsx @@ -88,7 +88,7 @@ const DropTip = () => { ) } -const FileTree: React.FC = ({ className }) => { +const FileTree = ({ className }: FileTreeProps) => { const { t } = useTranslation('workflow') const treeRef = useRef>(null) const containerRef = useRef(null) diff --git a/web/app/components/workflow/skill/file-tree/menu-item.tsx b/web/app/components/workflow/skill/file-tree/menu-item.tsx index 1fc6356e50..b6bf17b88d 100644 --- a/web/app/components/workflow/skill/file-tree/menu-item.tsx +++ b/web/app/components/workflow/skill/file-tree/menu-item.tsx @@ -1,7 +1,6 @@ 'use client' import type { VariantProps } from 'class-variance-authority' -import type { FC } from 'react' import { cva } from 'class-variance-authority' import * as React from 'react' import ShortcutsName from '@/app/components/workflow/shortcuts-name' @@ -58,7 +57,7 @@ export type MenuItemProps = { disabled?: boolean } & VariantProps -const MenuItem: FC = ({ icon: Icon, label, kbd, onClick, disabled, variant }) => { +const MenuItem = ({ icon: Icon, label, kbd, onClick, disabled, variant }: MenuItemProps) => { const handleClick = React.useCallback((event: React.MouseEvent) => { event.stopPropagation() onClick(event) diff --git a/web/app/components/workflow/skill/file-tree/node-menu.tsx b/web/app/components/workflow/skill/file-tree/node-menu.tsx index c208c8a9be..9d1c4802c2 100644 --- a/web/app/components/workflow/skill/file-tree/node-menu.tsx +++ b/web/app/components/workflow/skill/file-tree/node-menu.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import type { NodeApi, TreeApi } from 'react-arborist' import type { NodeMenuType } from '../constants' import type { TreeNodeData } from '../type' @@ -42,14 +41,14 @@ type NodeMenuProps = { node?: NodeApi } -const NodeMenu: FC = ({ +const NodeMenu = ({ type, nodeId, onClose, className, treeRef, node, -}) => { +}: NodeMenuProps) => { const { t } = useTranslation('workflow') const storeApi = useWorkflowStore() const selectedNodeIds = useStore(s => s.selectedNodeIds) diff --git a/web/app/components/workflow/skill/file-tree/tree-context-menu.tsx b/web/app/components/workflow/skill/file-tree/tree-context-menu.tsx index 6c3e5b0dee..3fb49c763b 100644 --- a/web/app/components/workflow/skill/file-tree/tree-context-menu.tsx +++ b/web/app/components/workflow/skill/file-tree/tree-context-menu.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import type { TreeApi } from 'react-arborist' import type { TreeNodeData } from '../type' import { useClickAway } from 'ahooks' @@ -14,7 +13,7 @@ type TreeContextMenuProps = { treeRef: React.RefObject | null> } -const TreeContextMenu: FC = ({ treeRef }) => { +const TreeContextMenu = ({ treeRef }: TreeContextMenuProps) => { const ref = useRef(null) const contextMenu = useStore(s => s.contextMenu) const storeApi = useWorkflowStore() diff --git a/web/app/components/workflow/skill/file-tree/tree-edit-input.tsx b/web/app/components/workflow/skill/file-tree/tree-edit-input.tsx index 8c6a5b28af..8a5dcb6345 100644 --- a/web/app/components/workflow/skill/file-tree/tree-edit-input.tsx +++ b/web/app/components/workflow/skill/file-tree/tree-edit-input.tsx @@ -10,7 +10,7 @@ type TreeEditInputProps = { node: NodeApi } -const TreeEditInput: React.FC = ({ node }) => { +const TreeEditInput = ({ node }: TreeEditInputProps) => { const { t } = useTranslation('workflow') const inputRef = useRef(null) const isFolder = node.data.node_type === 'folder' diff --git a/web/app/components/workflow/skill/file-tree/tree-guide-lines.tsx b/web/app/components/workflow/skill/file-tree/tree-guide-lines.tsx index 49b78b8bc6..e244f3530e 100644 --- a/web/app/components/workflow/skill/file-tree/tree-guide-lines.tsx +++ b/web/app/components/workflow/skill/file-tree/tree-guide-lines.tsx @@ -12,11 +12,11 @@ type TreeGuideLinesProps = { const INDENT_SIZE = 20 const DEFAULT_LINE_OFFSET = 10 -const TreeGuideLines: React.FC = ({ +const TreeGuideLines = ({ level, indentSize = INDENT_SIZE, lineOffset = DEFAULT_LINE_OFFSET, -}) => { +}: TreeGuideLinesProps) => { const guides = useMemo(() => { if (level === 0) return null diff --git a/web/app/components/workflow/skill/file-tree/tree-node-icon.tsx b/web/app/components/workflow/skill/file-tree/tree-node-icon.tsx index 569338ae80..28f6c18e24 100644 --- a/web/app/components/workflow/skill/file-tree/tree-node-icon.tsx +++ b/web/app/components/workflow/skill/file-tree/tree-node-icon.tsx @@ -2,7 +2,6 @@ // Icon rendering for tree nodes (folder/file icons with dirty indicator) -import type { FC } from 'react' import type { FileAppearanceType } from '@/app/components/base/file-uploader/types' import { RiFolderLine, RiFolderOpenLine } from '@remixicon/react' import { useTranslation } from 'react-i18next' @@ -19,14 +18,14 @@ type TreeNodeIconProps = { onToggle?: (e: React.MouseEvent) => void } -export const TreeNodeIcon: FC = ({ +export const TreeNodeIcon = ({ isFolder, isOpen, fileName, extension, isDirty, onToggle, -}) => { +}: TreeNodeIconProps) => { const { t } = useTranslation('workflow') if (isFolder) { diff --git a/web/app/components/workflow/skill/file-tree/upload-status-tooltip.tsx b/web/app/components/workflow/skill/file-tree/upload-status-tooltip.tsx index 678cfd81c3..606e5a6650 100644 --- a/web/app/components/workflow/skill/file-tree/upload-status-tooltip.tsx +++ b/web/app/components/workflow/skill/file-tree/upload-status-tooltip.tsx @@ -1,6 +1,6 @@ 'use client' -import type { FC, ReactNode } from 'react' +import type { ReactNode } from 'react' import { RiAlertFill, RiCheckboxCircleFill, @@ -18,7 +18,7 @@ type UploadStatusTooltipProps = { const SUCCESS_DISPLAY_MS = 2000 -const UploadStatusTooltip: FC = ({ fallback }) => { +const UploadStatusTooltip = ({ fallback }: UploadStatusTooltipProps) => { const { t } = useTranslation('workflow') const storeApi = useWorkflowStore() const uploadStatus = useStore(s => s.uploadStatus) diff --git a/web/app/components/workflow/skill/main.tsx b/web/app/components/workflow/skill/main.tsx index 1e0c5f1fa5..610e056544 100644 --- a/web/app/components/workflow/skill/main.tsx +++ b/web/app/components/workflow/skill/main.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import * as React from 'react' import { useStore as useAppStore } from '@/app/components/app/store' import ContentArea from './content-area' @@ -15,12 +14,12 @@ import Sidebar from './sidebar' import SidebarSearchAdd from './sidebar-search-add' import SkillPageLayout from './skill-page-layout' -const SkillAutoSaveManager: FC = () => { +const SkillAutoSaveManager = () => { useSkillAutoSave() return null } -const SkillMain: FC = () => { +const SkillMain = () => { const appDetail = useAppStore(s => s.appDetail) const appId = appDetail?.id || '' diff --git a/web/app/components/workflow/skill/sidebar-search-add.tsx b/web/app/components/workflow/skill/sidebar-search-add.tsx index 08838e1013..acf5718a16 100644 --- a/web/app/components/workflow/skill/sidebar-search-add.tsx +++ b/web/app/components/workflow/skill/sidebar-search-add.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import { RiAddLine, RiFileAddLine, @@ -32,7 +31,7 @@ type MenuItemProps = { disabled?: boolean } -const MenuItem: React.FC = ({ icon: Icon, label, onClick, disabled }) => ( +const MenuItem = ({ icon: Icon, label, onClick, disabled }: MenuItemProps) => ( ) -const SidebarSearchAdd: FC = () => { +const SidebarSearchAdd = () => { const { t } = useTranslation('workflow') const searchValue = useStore(s => s.fileTreeSearchTerm) const storeApi = useWorkflowStore() diff --git a/web/app/components/workflow/skill/sidebar.tsx b/web/app/components/workflow/skill/sidebar.tsx index 996f61db64..91b6548a8c 100644 --- a/web/app/components/workflow/skill/sidebar.tsx +++ b/web/app/components/workflow/skill/sidebar.tsx @@ -1,6 +1,6 @@ 'use client' -import type { FC, PropsWithChildren } from 'react' +import type { PropsWithChildren } from 'react' import { useDebounceFn } from 'ahooks' import * as React from 'react' import { useCallback } from 'react' @@ -11,7 +11,7 @@ import { SIDEBAR_DEFAULT_WIDTH, SIDEBAR_MAX_WIDTH, SIDEBAR_MIN_WIDTH } from './c type SidebarProps = PropsWithChildren -const Sidebar: FC = ({ children }) => { +const Sidebar = ({ children }: SidebarProps) => { const { run: persistWidth } = useDebounceFn( (width: number) => storage.set(STORAGE_KEYS.SKILL.SIDEBAR_WIDTH, width), { wait: 200 }, diff --git a/web/app/components/workflow/skill/skill-page-layout.tsx b/web/app/components/workflow/skill/skill-page-layout.tsx index 3adbb409aa..7671c66f0e 100644 --- a/web/app/components/workflow/skill/skill-page-layout.tsx +++ b/web/app/components/workflow/skill/skill-page-layout.tsx @@ -1,9 +1,9 @@ -import type { FC, PropsWithChildren } from 'react' +import type { PropsWithChildren } from 'react' import * as React from 'react' type SkillPageLayoutProps = PropsWithChildren -const SkillPageLayout: FC = ({ children }) => { +const SkillPageLayout = ({ children }: SkillPageLayoutProps) => { return (
{children} diff --git a/web/app/components/workflow/skill/start-tab-item.tsx b/web/app/components/workflow/skill/start-tab-item.tsx index 8bfdce86c3..3f6559293e 100644 --- a/web/app/components/workflow/skill/start-tab-item.tsx +++ b/web/app/components/workflow/skill/start-tab-item.tsx @@ -1,6 +1,5 @@ 'use client' -import type { FC } from 'react' import * as React from 'react' import { useTranslation } from 'react-i18next' import Home from '@/app/components/base/icons/src/vender/workflow/Home' @@ -11,10 +10,10 @@ type StartTabItemProps = { onClick: () => void } -const StartTabItem: FC = ({ +const StartTabItem = ({ isActive, onClick, -}) => { +}: StartTabItemProps) => { const { t } = useTranslation('workflow') return ( diff --git a/web/app/components/workflow/skill/start-tab/action-card.tsx b/web/app/components/workflow/skill/start-tab/action-card.tsx index 654092b1b1..3acb5d061c 100644 --- a/web/app/components/workflow/skill/start-tab/action-card.tsx +++ b/web/app/components/workflow/skill/start-tab/action-card.tsx @@ -1,6 +1,6 @@ 'use client' -import type { FC, ReactNode } from 'react' +import type { ReactNode } from 'react' import { memo } from 'react' import { cn } from '@/utils/classnames' @@ -11,12 +11,12 @@ type ActionCardProps = { onClick?: () => void } -const ActionCard: FC = ({ +const ActionCard = ({ icon, title, description, onClick, -}) => { +}: ActionCardProps) => { return (