refactor(skill): rename components for semantic clarity

Rename components and reorganize directory structure:
- skill-doc-editor.tsx → file-content-panel.tsx (handles edit/preview/download)
- editor-area.tsx → content-area.tsx
- editor-body.tsx → content-body.tsx
- editor-tabs.tsx → file-tabs.tsx
- editor-tab-item.tsx → file-tab-item.tsx

Create viewer/ directory for non-editor components:
- Move media-file-preview.tsx from editor/ to viewer/
- Move unsupported-file-download.tsx from editor/ to viewer/

This clarifies the distinction between:
- editor/: actual file editors (code, markdown)
- viewer/: preview and download components (media, unsupported files)
This commit is contained in:
yyh
2026-01-19 23:50:08 +08:00
parent cab33d440b
commit bc9ce23fdc
8 changed files with 27 additions and 27 deletions

View File

@ -1,9 +1,9 @@
import type { FC, PropsWithChildren } from 'react'
import * as React from 'react'
type EditorAreaProps = PropsWithChildren
type ContentAreaProps = PropsWithChildren
const EditorArea: FC<EditorAreaProps> = ({ children }) => {
const ContentArea: FC<ContentAreaProps> = ({ children }) => {
return (
<section className="flex min-h-0 flex-1 flex-col rounded-lg">
{children}
@ -11,4 +11,4 @@ const EditorArea: FC<EditorAreaProps> = ({ children }) => {
)
}
export default React.memo(EditorArea)
export default React.memo(ContentArea)

View File

@ -1,9 +1,9 @@
import type { FC, PropsWithChildren } from 'react'
import * as React from 'react'
type EditorBodyProps = PropsWithChildren
type ContentBodyProps = PropsWithChildren
const EditorBody: FC<EditorBodyProps> = ({ children }) => {
const ContentBody: FC<ContentBodyProps> = ({ children }) => {
return (
<div className="flex min-h-0 flex-1">
{children}
@ -11,4 +11,4 @@ const EditorBody: FC<EditorBodyProps> = ({ children }) => {
)
}
export default React.memo(EditorBody)
export default React.memo(ContentBody)

View File

@ -14,18 +14,18 @@ import { Theme } from '@/types/app'
import { basePath } from '@/utils/var'
import CodeFileEditor from './editor/code-file-editor'
import MarkdownFileEditor from './editor/markdown-file-editor'
import MediaFilePreview from './editor/media-file-preview'
import UnsupportedFileDownload from './editor/unsupported-file-download'
import { useFileTypeInfo } from './hooks/use-file-type-info'
import { useSkillAssetNodeMap } from './hooks/use-skill-asset-tree'
import { useSkillFileData } from './hooks/use-skill-file-data'
import { useSkillFileSave } from './hooks/use-skill-file-save'
import { getFileLanguage } from './utils/file-utils'
import MediaFilePreview from './viewer/media-file-preview'
import UnsupportedFileDownload from './viewer/unsupported-file-download'
if (typeof window !== 'undefined')
loader.config({ paths: { vs: `${window.location.origin}${basePath}/vs` } })
const SkillDocEditor: FC = () => {
const FileContentPanel: FC = () => {
const { t } = useTranslation('workflow')
const { theme: appTheme } = useTheme()
const [isMounted, setIsMounted] = useState(false)
@ -199,4 +199,4 @@ const SkillDocEditor: FC = () => {
)
}
export default React.memo(SkillDocEditor)
export default React.memo(FileContentPanel)

View File

@ -10,7 +10,7 @@ import FileTypeIcon from '@/app/components/base/file-uploader/file-type-icon'
import { cn } from '@/utils/classnames'
import { getFileIconType } from './utils/file-utils'
type EditorTabItemProps = {
type FileTabItemProps = {
fileId: string
name: string
isActive: boolean
@ -21,7 +21,7 @@ type EditorTabItemProps = {
onDoubleClick: (fileId: string) => void
}
const EditorTabItem: FC<EditorTabItemProps> = ({
const FileTabItem: FC<FileTabItemProps> = ({
fileId,
name,
isActive,
@ -100,4 +100,4 @@ const EditorTabItem: FC<EditorTabItemProps> = ({
)
}
export default React.memo(EditorTabItem)
export default React.memo(FileTabItem)

View File

@ -7,10 +7,10 @@ import { useTranslation } from 'react-i18next'
import Confirm from '@/app/components/base/confirm'
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
import { cn } from '@/utils/classnames'
import EditorTabItem from './editor-tab-item'
import FileTabItem from './file-tab-item'
import { useSkillAssetNodeMap } from './hooks/use-skill-asset-tree'
const EditorTabs: FC = () => {
const FileTabs: FC = () => {
const { t } = useTranslation('workflow')
const openTabIds = useStore(s => s.openTabIds)
const activeTabId = useStore(s => s.activeTabId)
@ -73,7 +73,7 @@ const EditorTabs: FC = () => {
const isPreview = previewTabId === fileId
return (
<EditorTabItem
<FileTabItem
key={fileId}
fileId={fileId}
name={name}
@ -100,4 +100,4 @@ const EditorTabs: FC = () => {
)
}
export default React.memo(EditorTabs)
export default React.memo(FileTabs)

View File

@ -3,13 +3,13 @@
import type { FC } from 'react'
import * as React from 'react'
import { useCallback, useState } from 'react'
import EditorArea from './editor-area'
import EditorBody from './editor-body'
import EditorTabs from './editor-tabs'
import ContentArea from './content-area'
import ContentBody from './content-body'
import FileContentPanel from './file-content-panel'
import FileTabs from './file-tabs'
import FileTree from './file-tree'
import Sidebar from './sidebar'
import SidebarSearchAdd from './sidebar-search-add'
import SkillDocEditor from './skill-doc-editor'
import SkillPageLayout from './skill-page-layout'
const SkillMain: FC = () => {
@ -26,12 +26,12 @@ const SkillMain: FC = () => {
<SidebarSearchAdd onSearchChange={handleSearchChange} />
<FileTree searchTerm={searchTerm} />
</Sidebar>
<EditorArea>
<EditorTabs />
<EditorBody>
<SkillDocEditor />
</EditorBody>
</EditorArea>
<ContentArea>
<FileTabs />
<ContentBody>
<FileContentPanel />
</ContentBody>
</ContentArea>
</SkillPageLayout>
</div>
)