Revert "refactor(skill): replace React icon components with CSS Icons"

This reverts commit 919d7ef5cd.
This commit is contained in:
yyh
2026-01-30 12:42:00 +08:00
parent d2a60b3b94
commit 561f383cbc
19 changed files with 104 additions and 60 deletions

View File

@ -1,9 +1,11 @@
'use client'
import type { SandboxFileTreeNode } from '@/types/sandbox-file'
import { RiArrowDownSLine, RiArrowRightSLine, RiLoader2Line } from '@remixicon/react'
import * as React from 'react'
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import FolderSpark from '@/app/components/base/icons/src/vender/workflow/FolderSpark'
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
import { useAppContext } from '@/context/app-context'
import { useDownloadSandboxFile, useSandboxFilesTree } from '@/service/use-sandbox-file'
@ -65,7 +67,7 @@ const ArtifactsSection = ({ className }: ArtifactsSectionProps) => {
>
<div className="flex flex-1 items-center gap-1 py-0.5">
<div className="flex size-5 items-center justify-center">
<span className="i-custom-vender-workflow-folder-spark size-4 text-text-secondary" aria-hidden="true" />
<FolderSpark className="size-4 text-text-secondary" aria-hidden="true" />
</div>
<span className="system-sm-semibold uppercase text-text-secondary">
{t('skillSidebar.artifacts.title')}
@ -74,15 +76,15 @@ const ArtifactsSection = ({ className }: ArtifactsSectionProps) => {
<div className="relative flex items-center">
{showSpinner
? <span className="i-ri-loader-2-line size-3.5 animate-spin text-text-tertiary" aria-hidden="true" />
? <RiLoader2Line className="size-3.5 animate-spin text-text-tertiary" aria-hidden="true" />
: (
<>
{showBlueDot && (
<div className="absolute -left-2 size-[7px] rounded-full border border-white bg-state-accent-solid" />
)}
{isExpanded
? <span className="i-ri-arrow-down-s-line size-4 text-text-tertiary" aria-hidden="true" />
: <span className="i-ri-arrow-right-s-line size-4 text-text-tertiary" aria-hidden="true" />}
? <RiArrowDownSLine className="size-4 text-text-tertiary" aria-hidden="true" />
: <RiArrowRightSLine className="size-4 text-text-tertiary" aria-hidden="true" />}
</>
)}
</div>

View File

@ -2,6 +2,7 @@
import type { FileAppearanceType } from '@/app/components/base/file-uploader/types'
import type { SandboxFileTreeNode } from '@/types/sandbox-file'
import { RiDownloadLine, RiFolderLine, RiFolderOpenLine } from '@remixicon/react'
import * as React from 'react'
import { useCallback, useState } from 'react'
import FileTypeIcon from '@/app/components/base/file-uploader/file-type-icon'
@ -83,8 +84,8 @@ const ArtifactsTreeNode = ({
{isFolder
? (
isExpanded
? <span className="i-ri-folder-open-line size-4 text-text-accent" aria-hidden="true" />
: <span className="i-ri-folder-line size-4 text-text-secondary" aria-hidden="true" />
? <RiFolderOpenLine className="size-4 text-text-accent" aria-hidden="true" />
: <RiFolderLine className="size-4 text-text-secondary" aria-hidden="true" />
)
: <FileTypeIcon type={fileIconType as FileAppearanceType} size="sm" />}
</div>
@ -106,7 +107,7 @@ const ArtifactsTreeNode = ({
)}
aria-label={`Download ${node.name}`}
>
<span className="i-ri-download-line size-3.5 text-text-tertiary" />
<RiDownloadLine className="size-3.5 text-text-tertiary" />
</button>
)}
</div>

View File

@ -4,6 +4,7 @@ import type { MoveHandler, NodeApi, NodeRendererProps, TreeApi } from 'react-arb
import type { TreeNodeData } from '../type'
import type { OpensObject } from '@/app/components/workflow/store/workflow/skill-editor/file-tree-slice'
import type { AppAssetTreeView } from '@/types/app-asset'
import { RiDragDropLine } from '@remixicon/react'
import { useIsMutating } from '@tanstack/react-query'
import { useSize } from 'ahooks'
import * as React from 'react'
@ -11,6 +12,7 @@ import { useCallback, useEffect, useMemo, useRef } from 'react'
import { Tree } from 'react-arborist'
import { useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'
import SearchMenu from '@/app/components/base/icons/src/vender/knowledge/SearchMenu'
import Loading from '@/app/components/base/loading'
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
import { cn } from '@/utils/classnames'
@ -79,7 +81,7 @@ const DropTip = () => {
const { t } = useTranslation('workflow')
return (
<div className="flex shrink-0 items-center justify-center gap-2 py-4 text-text-quaternary">
<span className="i-ri-drag-drop-line size-4" aria-hidden="true" />
<RiDragDropLine className="size-4" aria-hidden="true" />
<span className="system-xs-regular">
{t('skillSidebar.dropTip')}
</span>
@ -346,7 +348,7 @@ const FileTree = ({ className }: FileTreeProps) => {
return (
<div className={cn('flex min-h-[150px] flex-1 flex-col overflow-y-auto', className)}>
<div className="flex flex-1 flex-col items-center justify-center gap-2 pb-20">
<span className="i-custom-vender-knowledge-search-menu size-8 text-text-tertiary" aria-hidden="true" />
<SearchMenu className="size-8 text-text-tertiary" aria-hidden="true" />
<span className="system-xs-regular text-text-secondary">
{t('skillSidebar.searchNoResults')}
</span>

View File

@ -50,14 +50,14 @@ const labelVariants = cva('system-sm-regular text-text-secondary', {
})
export type MenuItemProps = {
icon: string
icon: React.ElementType
label: string
kbd?: readonly string[]
onClick: React.MouseEventHandler<HTMLButtonElement>
disabled?: boolean
} & VariantProps<typeof menuItemVariants>
const MenuItem = ({ icon, label, kbd, onClick, disabled, variant }: MenuItemProps) => {
const MenuItem = ({ icon: Icon, label, kbd, onClick, disabled, variant }: MenuItemProps) => {
const handleClick = React.useCallback((event: React.MouseEvent<HTMLButtonElement>) => {
event.stopPropagation()
onClick(event)
@ -70,7 +70,7 @@ const MenuItem = ({ icon, label, kbd, onClick, disabled, variant }: MenuItemProp
disabled={disabled}
className={cn(menuItemVariants({ variant }))}
>
<span className={cn(icon, iconVariants({ variant }))} aria-hidden="true" />
<Icon className={cn(iconVariants({ variant }))} aria-hidden="true" />
<span className={cn(labelVariants({ variant }), 'flex-1 text-left')}>{label}</span>
{kbd && kbd.length > 0 && <ShortcutsName keys={kbd} textColor="secondary" />}
</button>

View File

@ -3,10 +3,21 @@
import type { NodeApi, TreeApi } from 'react-arborist'
import type { NodeMenuType } from '../constants'
import type { TreeNodeData } from '../type'
import {
RiClipboardLine,
RiDeleteBinLine,
RiEdit2Line,
RiFileAddLine,
RiFolderAddLine,
RiFolderUploadLine,
RiScissorsLine,
RiUploadLine,
} from '@remixicon/react'
import * as React from 'react'
import { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import Confirm from '@/app/components/base/confirm'
import { Download02 } from '@/app/components/base/icons/src/vender/solid/general'
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
import { cn } from '@/utils/classnames'
import { NODE_MENU_TYPE } from '../constants'
@ -108,13 +119,13 @@ const NodeMenu = ({
/>
<MenuItem
icon="i-ri-file-add-line"
icon={RiFileAddLine}
label={t('skillSidebar.menu.newFile')}
onClick={handleNewFile}
disabled={isLoading}
/>
<MenuItem
icon="i-ri-folder-add-line"
icon={RiFolderAddLine}
label={t('skillSidebar.menu.newFolder')}
onClick={handleNewFolder}
disabled={isLoading}
@ -123,13 +134,13 @@ const NodeMenu = ({
<div className="my-1 h-px bg-divider-subtle" />
<MenuItem
icon="i-ri-upload-line"
icon={RiUploadLine}
label={t('skillSidebar.menu.uploadFile')}
onClick={() => fileInputRef.current?.click()}
disabled={isLoading}
/>
<MenuItem
icon="i-ri-folder-upload-line"
icon={RiFolderUploadLine}
label={t('skillSidebar.menu.uploadFolder')}
onClick={() => folderInputRef.current?.click()}
disabled={isLoading}
@ -142,7 +153,7 @@ const NodeMenu = ({
{!isFolder && (
<>
<MenuItem
icon="i-custom-vender-solid-general-download-02"
icon={Download02}
label={t('skillSidebar.menu.download')}
onClick={handleDownload}
disabled={isLoading}
@ -154,7 +165,7 @@ const NodeMenu = ({
{!isRoot && (
<>
<MenuItem
icon="i-ri-scissors-line"
icon={RiScissorsLine}
label={t('skillSidebar.menu.cut')}
kbd={KBD_CUT}
onClick={handleCut}
@ -165,7 +176,7 @@ const NodeMenu = ({
{isFolder && hasClipboard && (
<MenuItem
icon="i-ri-clipboard-line"
icon={RiClipboardLine}
label={t('skillSidebar.menu.paste')}
kbd={KBD_PASTE}
onClick={handlePaste}
@ -177,13 +188,13 @@ const NodeMenu = ({
<>
<div className="my-1 h-px bg-divider-subtle" />
<MenuItem
icon="i-ri-edit-2-line"
icon={RiEdit2Line}
label={t('skillSidebar.menu.rename')}
onClick={handleRename}
disabled={isLoading}
/>
<MenuItem
icon="i-ri-delete-bin-line"
icon={RiDeleteBinLine}
label={t('skillSidebar.menu.delete')}
onClick={handleDeleteClick}
disabled={isLoading}

View File

@ -3,6 +3,7 @@
// Icon rendering for tree nodes (folder/file icons with dirty indicator)
import type { FileAppearanceType } from '@/app/components/base/file-uploader/types'
import { RiFolderLine, RiFolderOpenLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import FileTypeIcon from '@/app/components/base/file-uploader/file-type-icon'
import { cn } from '@/utils/classnames'
@ -40,8 +41,8 @@ export const TreeNodeIcon = ({
)}
>
{isOpen
? <span className="i-ri-folder-open-line size-4 text-text-accent" aria-hidden="true" />
: <span className="i-ri-folder-line size-4 text-text-secondary" aria-hidden="true" />}
? <RiFolderOpenLine className="size-4 text-text-accent" aria-hidden="true" />
: <RiFolderLine className="size-4 text-text-secondary" aria-hidden="true" />}
</button>
)
}

View File

@ -2,6 +2,7 @@
import type { NodeRendererProps } from 'react-arborist'
import type { TreeNodeData } from '../type'
import { RiMoreFill } from '@remixicon/react'
import * as React from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@ -170,7 +171,7 @@ const TreeNode = ({ node, style, dragHandle, treeChildren }: TreeNodeProps) => {
)}
aria-label={t('skillSidebar.menu.moreActions')}
>
<span className="i-ri-more-fill size-4 text-text-tertiary" aria-hidden="true" />
<RiMoreFill className="size-4 text-text-tertiary" aria-hidden="true" />
</button>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent className="z-[100]">

View File

@ -1,6 +1,12 @@
'use client'
import type { ReactNode } from 'react'
import {
RiAlertFill,
RiCheckboxCircleFill,
RiCloseLine,
RiUploadCloud2Line,
} from '@remixicon/react'
import { memo, useEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
@ -68,13 +74,13 @@ const UploadStatusTooltip = ({ fallback }: UploadStatusTooltipProps) => {
<div className="relative z-10 shrink-0">
{uploadStatus === 'uploading' && (
<span className="i-ri-upload-cloud-2-line size-6 text-text-accent" />
<RiUploadCloud2Line className="size-6 text-text-accent" />
)}
{uploadStatus === 'success' && (
<span className="i-ri-checkbox-circle-fill size-5 text-text-success" />
<RiCheckboxCircleFill className="size-5 text-text-success" />
)}
{uploadStatus === 'partial_error' && (
<span className="i-ri-alert-fill size-5 text-text-warning" />
<RiAlertFill className="size-5 text-text-warning" />
)}
</div>
@ -112,7 +118,7 @@ const UploadStatusTooltip = ({ fallback }: UploadStatusTooltipProps) => {
className="relative z-10 shrink-0 rounded p-0.5 text-text-tertiary hover:text-text-secondary focus-visible:outline focus-visible:outline-2 focus-visible:outline-state-accent-solid"
onClick={handleClose}
>
<span className="i-ri-close-line size-4" />
<RiCloseLine className="size-4" />
</button>
</div>
</div>