From b0eca12d8863be53f60c33e36986440af812ba3d Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 15 Jan 2026 11:21:55 +0800 Subject: [PATCH] feat: tabs --- .../components/workflow/skill/editor-area.tsx | 2 +- .../components/workflow/skill/editor-body.tsx | 2 +- .../workflow/skill/editor-tab-item.tsx | 59 ++++++++++++++++++- .../components/workflow/skill/editor-tabs.tsx | 19 ++++-- web/app/components/workflow/skill/main.tsx | 8 +-- .../components/workflow/skill/mock-data.ts | 32 ++++++++++ .../workflow/skill/skill-doc-editor.tsx | 2 +- 7 files changed, 107 insertions(+), 17 deletions(-) diff --git a/web/app/components/workflow/skill/editor-area.tsx b/web/app/components/workflow/skill/editor-area.tsx index d6f4858c30..862af84db4 100644 --- a/web/app/components/workflow/skill/editor-area.tsx +++ b/web/app/components/workflow/skill/editor-area.tsx @@ -6,7 +6,7 @@ type EditorAreaProps = PropsWithChildren const EditorArea: FC = ({ children }) => { return (
{children} diff --git a/web/app/components/workflow/skill/editor-body.tsx b/web/app/components/workflow/skill/editor-body.tsx index 2584f8cc12..9128ff950e 100644 --- a/web/app/components/workflow/skill/editor-body.tsx +++ b/web/app/components/workflow/skill/editor-body.tsx @@ -6,7 +6,7 @@ type EditorBodyProps = PropsWithChildren const EditorBody: FC = ({ children }) => { return (
{children} diff --git a/web/app/components/workflow/skill/editor-tab-item.tsx b/web/app/components/workflow/skill/editor-tab-item.tsx index ca1e643899..f7f11bb7d5 100644 --- a/web/app/components/workflow/skill/editor-tab-item.tsx +++ b/web/app/components/workflow/skill/editor-tab-item.tsx @@ -1,12 +1,65 @@ import type { FC } from 'react' +import type { FileAppearanceType } from '../../base/file-uploader/types' +import type { SkillTabItem } from './mock-data' +import { RiCloseLine, RiHome9Line } from '@remixicon/react' import * as React from 'react' +import { useTranslation } from 'react-i18next' +import FileTypeIcon from '@/app/components/base/file-uploader/file-type-icon' +import { cn } from '@/utils/classnames' +import { getFileIconType } from './utils' + +type EditorTabItemProps = { + item: SkillTabItem +} + +const EditorTabItem: FC = ({ item }) => { + const { t } = useTranslation() + const isStart = item.type === 'start' + const isActive = Boolean(item.active) + const label = isStart ? item.name.toUpperCase() : item.name + const iconType = isStart ? null : getFileIconType(item.name) -const EditorTabItem: FC = () => { return (
+ > +
+
+ {isStart + ? ( + + ) + : ( + + )} +
+ + {label} + +
+ {!isStart && ( + + )} +
) } diff --git a/web/app/components/workflow/skill/editor-tabs.tsx b/web/app/components/workflow/skill/editor-tabs.tsx index 12f3d6205f..ab4b44b1ba 100644 --- a/web/app/components/workflow/skill/editor-tabs.tsx +++ b/web/app/components/workflow/skill/editor-tabs.tsx @@ -1,15 +1,24 @@ -import type { FC, PropsWithChildren } from 'react' +import type { FC } from 'react' +import type { SkillTabItem } from './mock-data' import * as React from 'react' +import { cn } from '@/utils/classnames' +import EditorTabItem from './editor-tab-item' -type EditorTabsProps = PropsWithChildren +type EditorTabsProps = { + items: SkillTabItem[] +} -const EditorTabs: FC = ({ children }) => { +const EditorTabs: FC = ({ items }) => { return (
- {children} + {items.map(item => ( + + ))}
) } diff --git a/web/app/components/workflow/skill/main.tsx b/web/app/components/workflow/skill/main.tsx index 179b9c4d9c..f085dc0f82 100644 --- a/web/app/components/workflow/skill/main.tsx +++ b/web/app/components/workflow/skill/main.tsx @@ -3,10 +3,9 @@ import type { FC } from 'react' import * as React from 'react' import EditorArea from './editor-area' import EditorBody from './editor-body' -import EditorTabItem from './editor-tab-item' import EditorTabs from './editor-tabs' import Files from './files' -import { mockSkillItems } from './mock-data' +import { mockSkillItems, mockSkillTabs } from './mock-data' import Sidebar from './sidebar' import SidebarSearchAdd from './sidebar-search-add' import SkillDocEditor from './skill-doc-editor' @@ -23,10 +22,7 @@ const SkillMain: FC = () => { - - - - + diff --git a/web/app/components/workflow/skill/mock-data.ts b/web/app/components/workflow/skill/mock-data.ts index 7962c3ac05..830fca5014 100644 --- a/web/app/components/workflow/skill/mock-data.ts +++ b/web/app/components/workflow/skill/mock-data.ts @@ -119,3 +119,35 @@ export const mockSkillItems: ResourceItem[] = [ kind: ResourceKind.folder, }, ] + +export type SkillTabType = 'start' | 'file' +export type SkillTabItem = { + id: string + type: SkillTabType + name: string + active?: boolean +} + +export const mockSkillTabs: SkillTabItem[] = [ + { + id: 'tab-start', + type: 'start', + name: 'Start', + }, + { + id: 'tab-skill', + type: 'file', + name: 'SKILL.md', + active: true, + }, + { + id: 'tab-output', + type: 'file', + name: 'output.schema.json', + }, + { + id: 'tab-prompt', + type: 'file', + name: 'prompt.md', + }, +] diff --git a/web/app/components/workflow/skill/skill-doc-editor.tsx b/web/app/components/workflow/skill/skill-doc-editor.tsx index 89b5e08c98..7a8f347657 100644 --- a/web/app/components/workflow/skill/skill-doc-editor.tsx +++ b/web/app/components/workflow/skill/skill-doc-editor.tsx @@ -4,7 +4,7 @@ import * as React from 'react' const SkillDocEditor: FC = () => { return (
)