From 70d88bc522f55a17003c6ad8202ea5e7b5b2e813 Mon Sep 17 00:00:00 2001 From: yyh Date: Mon, 26 Jan 2026 16:19:28 +0800 Subject: [PATCH 1/4] refactor(sandbox): align artifacts tree with file tree styles Reuse TreeGuideLines for indent lines, use FileTypeIcon for file icons, and match folder open/close icons with the main file tree component. --- .../skill/file-tree/artifacts-tree.tsx | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) 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 79491ea4f4..03536d72e9 100644 --- a/web/app/components/workflow/skill/file-tree/artifacts-tree.tsx +++ b/web/app/components/workflow/skill/file-tree/artifacts-tree.tsx @@ -1,11 +1,17 @@ '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, RiFile3Fill, RiFolderLine } from '@remixicon/react' +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' import { cn } from '@/utils/classnames' +import { getFileIconType } from '../utils/file-utils' +import TreeGuideLines from './tree-guide-lines' + +const INDENT_SIZE = 20 type ArtifactsTreeProps = { data: SandboxFileTreeNode[] | undefined @@ -40,6 +46,8 @@ const ArtifactsTreeNode: FC = ({ onDownload(node) }, [node, onDownload]) + const fileIconType = !isFolder ? getFileIconType(node.name) : null + return (
= ({ } : undefined} className={cn( - 'group flex items-center gap-0 rounded-md py-0.5 pr-1.5', + 'group relative flex h-6 items-center rounded-md px-2', isFolder && 'cursor-pointer hover:bg-state-base-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-components-input-border-active', !isFolder && 'hover:bg-state-base-hover', )} - style={{ paddingLeft: `${8 + depth * 20}px` }} + style={{ paddingLeft: `${8 + depth * INDENT_SIZE}px` }} > +
{isFolder - ? - : } + ? ( + isExpanded + ?
- + {node.name} From e5e43bc2b91aaf25d4c153822676fd02fd4964c3 Mon Sep 17 00:00:00 2001 From: yyh Date: Mon, 26 Jan 2026 16:37:51 +0800 Subject: [PATCH 2/4] fix(sandbox): fix guide line offset and use spinner for loading - Adjust TreeGuideLines lineOffset to 2 to center lines under folder icons - Replace skeleton loading with spinner in header area --- .../skill/file-tree/artifacts-section.tsx | 57 ++++++++++--------- .../skill/file-tree/artifacts-tree.tsx | 2 +- 2 files changed, 30 insertions(+), 29 deletions(-) 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 b74b086f0b..555febac1d 100644 --- a/web/app/components/workflow/skill/file-tree/artifacts-section.tsx +++ b/web/app/components/workflow/skill/file-tree/artifacts-section.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react' import type { SandboxFileTreeNode } from '@/types/sandbox-file' -import { RiArrowDownSLine, RiArrowRightSLine } from '@remixicon/react' +import { RiArrowDownSLine, RiArrowRightSLine, RiLoader2Line } from '@remixicon/react' import * as React from 'react' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' @@ -44,6 +44,7 @@ const ArtifactsSection: FC = ({ className }) => { }, [downloadMutation]) const showBlueDot = !isExpanded && hasFiles + const showSpinner = isLoading return (
@@ -68,40 +69,40 @@ const ArtifactsSection: FC = ({ className }) => {
- {showBlueDot && ( -
- )} - {isExpanded - ?