feat: add empty state for skill template search with no results

This commit is contained in:
yyh
2026-02-06 13:39:46 +08:00
parent 3eba0c561e
commit 30981dfa7c
3 changed files with 26 additions and 12 deletions

View File

@ -4,6 +4,7 @@ import type { SkillTemplateSummary } from './templates/types'
import { memo, useCallback, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useStore as useAppStore } from '@/app/components/app/store'
import { SearchMenu } from '@/app/components/base/icons/src/vender/knowledge'
import { useWorkflowStore } from '@/app/components/workflow/store'
import { useBatchUpload } from '@/service/use-app-asset'
import { useExistingSkillNames } from '../hooks/use-skill-asset-tree'
@ -89,18 +90,29 @@ const SkillTemplatesSection = () => {
<TemplateSearch onChange={setSearchQuery} />
</div>
</div>
<div className="grid grid-cols-3 gap-3 px-6">
{filtered.map(entry => (
<TemplateCard
key={entry.id}
template={entry}
added={existingNames?.has(entry.id) ?? false}
disabled={loadingId !== null}
loading={loadingId === entry.id}
onUse={handleUse}
/>
))}
</div>
{filtered.length === 0 && searchQuery
? (
<div className="flex flex-col items-center justify-center gap-y-2 py-16">
<SearchMenu className="size-8 text-text-quaternary" />
<span className="system-sm-regular text-text-tertiary">
{t('skill.startTab.noTemplatesFound')}
</span>
</div>
)
: (
<div className="grid grid-cols-3 gap-3 px-6">
{filtered.map(entry => (
<TemplateCard
key={entry.id}
template={entry}
added={existingNames?.has(entry.id) ?? false}
disabled={loadingId !== null}
loading={loadingId === entry.id}
onUse={handleUse}
/>
))}
</div>
)}
</section>
)
}

View File

@ -1103,6 +1103,7 @@
"skill.startTab.importModal.title": "Import Skill",
"skill.startTab.importSkill": "Import Skill",
"skill.startTab.importSkillDesc": "Import skill from skill.zip file",
"skill.startTab.noTemplatesFound": "No templates were found",
"skill.startTab.searchPlaceholder": "Search…",
"skill.startTab.skillAdded": "Added",
"skill.startTab.templatesComingSoon": "Templates coming soon…",

View File

@ -1095,6 +1095,7 @@
"skill.startTab.importModal.title": "导入 Skill",
"skill.startTab.importSkill": "导入 Skill",
"skill.startTab.importSkillDesc": "从 skill.zip 文件导入",
"skill.startTab.noTemplatesFound": "未找到模板",
"skill.startTab.searchPlaceholder": "搜索…",
"skill.startTab.skillAdded": "已添加",
"skill.startTab.templatesComingSoon": "模板即将推出…",