Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions packages/web/src/components/CategoryNav.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import LucideIcon from '@/components/LucideIcon';

const CATEGORIES = [
{ id: 'development', label: '开发', icon: '💻' },
{ id: 'efficiency', label: '效率', icon: '⚡' },
{ id: 'data', label: '数据', icon: '📊' },
{ id: 'communication', label: '沟通', icon: '💬' },
{ id: 'creative', label: '创意', icon: '🎨' },
{ id: 'security', label: '安全', icon: '🔒' },
{ id: 'operations', label: '运维', icon: '🔧' },
{ id: 'network', label: '网络', icon: '🌐' },
{ id: 'development', label: '开发', icon: 'Code2' },
{ id: 'efficiency', label: '效率', icon: 'Zap' },
{ id: 'data', label: '数据', icon: 'BarChart2' },
{ id: 'communication', label: '沟通', icon: 'MessageCircle' },
{ id: 'creative', label: '创意', icon: 'Palette' },
{ id: 'security', label: '安全', icon: 'Shield' },
{ id: 'operations', label: '运维', icon: 'Wrench' },
{ id: 'network', label: '网络', icon: 'Globe' },
] as const;

export default function CategoryNav({
Expand Down Expand Up @@ -40,7 +42,10 @@ export default function CategoryNav({
: 'bg-surface border border-border text-muted hover:text-gray-900 hover:border-gray-300'
}`}
>
{cat.icon} {cat.label}
<span className="inline-flex items-center gap-1.5">
<LucideIcon name={cat.icon} className="w-3.5 h-3.5 shrink-0" />
{cat.label}
</span>
</button>
))}
</div>
Expand Down
3 changes: 3 additions & 0 deletions packages/web/src/pages/Browse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export default function Browse() {
})
.catch(() => {
setFederatedItems([]);
setFederatedSources({ local: 0, clawhub: 0 });
setTotal(0);
setTotalPages(0);
setListError('搜索加载失败,请刷新重试');
})
.finally(() => setLoading(false));
Expand Down Expand Up @@ -120,6 +122,7 @@ export default function Browse() {
.catch(() => {
setGenes([]);
setTotal(0);
setTotalPages(0);
setListError('列表加载失败,请刷新重试');
})
.finally(() => setLoading(false));
Expand Down
5 changes: 4 additions & 1 deletion packages/web/src/pages/GeneDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,13 @@ export default function GeneDetail() {

useEffect(() => {
if (!slug) return;
setError('');
setGene(null);
setVersions([]);
setVersionsError(null);
getGene(slug)
.then(setGene)
.catch(() => setError('找不到该基因'));
setVersionsError(null);
getGeneVersions(slug)
.then(setVersions)
.catch(() => setVersionsError('版本历史加载失败,请刷新重试'));
Expand Down
5 changes: 3 additions & 2 deletions packages/web/src/pages/GenomeBrowse.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Search, Shield } from 'lucide-react';
import { FlaskConical, Search, Shield } from 'lucide-react';
import { useCallback, useEffect, useState } from 'react';
import { useSearchParams } from 'react-router-dom';
import { type Genome, listGenomes } from '@/api/client';
Expand Down Expand Up @@ -60,6 +60,7 @@ export default function GenomeBrowse() {
.catch(() => {
setGenomes([]);
setTotal(0);
setTotalPages(0);
setListError('列表加载失败,请刷新重试');
})
.finally(() => setLoading(false));
Expand Down Expand Up @@ -128,7 +129,7 @@ export default function GenomeBrowse() {
</div>
) : genomes.length === 0 ? (
<div className="text-center py-20">
<div className="text-4xl mb-4">🧫</div>
<FlaskConical className="w-12 h-12 mx-auto mb-4 text-muted" />
<p className="text-muted">暂无基因组</p>
</div>
) : (
Expand Down
5 changes: 4 additions & 1 deletion packages/web/src/pages/GenomeDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,13 @@ export default function GenomeDetail() {

useEffect(() => {
if (!slug) return;
setError('');
setGenome(null);
setVersions([]);
setVersionsError(null);
getGenome(slug)
.then(setGenome)
.catch(() => setError('找不到该基因组'));
setVersionsError(null);
getGenomeVersions(slug)
.then(setVersions)
.catch(() => setVersionsError('版本历史加载失败,请刷新重试'));
Expand Down
19 changes: 10 additions & 9 deletions packages/web/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import { useEffect, useState } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { type Gene, listGenes } from '@/api/client';
import GeneCard from '@/components/GeneCard';
import LucideIcon from '@/components/LucideIcon';
import { Button } from '@/components/ui/button';
import { Skeleton } from '@/components/ui/skeleton';

const CATEGORIES = [
{ id: 'development', label: '开发', icon: '💻', desc: '编码、测试、重构' },
{ id: 'efficiency', label: '效率', icon: '⚡', desc: '流程、自动化、工具' },
{ id: 'data', label: '数据', icon: '📊', desc: '分析、可视化、建模' },
{ id: 'communication', label: '沟通', icon: '💬', desc: '表达、协作、汇报' },
{ id: 'creative', label: '创意', icon: '🎨', desc: '设计、写作、脑暴' },
{ id: 'security', label: '安全', icon: '🔒', desc: '审计、加固、合规' },
{ id: 'operations', label: '运维', icon: '🔧', desc: '部署、监控、运维' },
{ id: 'network', label: '网络', icon: '🌐', desc: '协议、API、网关' },
{ id: 'development', label: '开发', icon: 'Code2', desc: '编码、测试、重构' },
{ id: 'efficiency', label: '效率', icon: 'Zap', desc: '流程、自动化、工具' },
{ id: 'data', label: '数据', icon: 'BarChart2', desc: '分析、可视化、建模' },
{ id: 'communication', label: '沟通', icon: 'MessageCircle', desc: '表达、协作、汇报' },
{ id: 'creative', label: '创意', icon: 'Palette', desc: '设计、写作、脑暴' },
{ id: 'security', label: '安全', icon: 'Shield', desc: '审计、加固、合规' },
{ id: 'operations', label: '运维', icon: 'Wrench', desc: '部署、监控、运维' },
{ id: 'network', label: '网络', icon: 'Globe', desc: '协议、API、网关' },
];

export default function Home() {
Expand Down Expand Up @@ -114,7 +115,7 @@ export default function Home() {
to={`/browse?category=${cat.id}`}
className="bg-surface rounded-xl border border-border p-4 text-center hover:shadow-md hover:border-primary/30 transition-all"
>
<div className="text-3xl mb-2">{cat.icon}</div>
<LucideIcon name={cat.icon} className="w-8 h-8 mx-auto mb-2" />
<div className="font-medium text-gray-900 text-sm">{cat.label}</div>
<div className="text-xs text-muted mt-1">{cat.desc}</div>
</Link>
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/pages/TemplateBrowse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default function TemplateBrowse() {
.catch(() => {
setTemplates([]);
setTotal(0);
setTotalPages(0);
setListError('列表加载失败,请刷新重试');
})
.finally(() => setLoading(false));
Expand Down
5 changes: 4 additions & 1 deletion packages/web/src/pages/TemplateDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,13 @@ export default function TemplateDetail() {

useEffect(() => {
if (!slug) return;
setError('');
setTemplate(null);
setVersions([]);
setVersionsError(null);
getTemplate(slug)
.then(setTemplate)
.catch(() => setError('找不到该 AI 员工模板'));
setVersionsError(null);
getTemplateVersions(slug)
.then(setVersions)
.catch(() => setVersionsError('版本历史加载失败,请刷新重试'));
Expand Down