diff --git a/ui/src/features/market/MarketSidebar.tsx b/ui/src/features/market/MarketSidebar.tsx index ae869a08..fade688f 100644 --- a/ui/src/features/market/MarketSidebar.tsx +++ b/ui/src/features/market/MarketSidebar.tsx @@ -1,4 +1,4 @@ -import { Bot, Cloud, Sparkles, Store } from "lucide-react"; +import { Bot, Cloud, Sparkles, Store, TerminalSquare } from "lucide-react"; import { BackendSidebarItem } from "@/features/backend-ui/BackendSidebarItem"; import { BackendSidebarSection } from "@/features/backend-ui/BackendSidebarSection"; @@ -7,120 +7,73 @@ import { StatusBadge } from "@/features/backend-ui/StatusBadge"; import { useMarketDirectory } from "@/features/market/useMarketDirectory"; export function MarketSidebar() { - const { - cloudPanels, - counts, - kind, - localEntries, - query, - selectedId, - setKind, - setSelected, - setSource, - source, - } = useMarketDirectory(); + const { counts, kind, localEntries, query, selectedId, setKind, setSelected, setSource, source } = useMarketDirectory(); const categoryItems = [ - { - count: counts.localAgents, - icon: Bot, - key: "agent" as const, - label: "Agent", - }, - { - count: counts.localSkills, - icon: Sparkles, - key: "skill" as const, - label: "Skill", - }, + { count: counts.localAgents, icon: Bot, key: "agent" as const, label: "代理" }, + { count: counts.localSkills, icon: Sparkles, key: "skill" as const, label: "技能" }, + { count: counts.localCLIs, icon: TerminalSquare, key: "cli" as const, label: "命令行" }, ]; + const localCount = kind === "agent" ? counts.localAgents : kind === "skill" ? counts.localSkills : counts.localCLIs; + const cloudCount = source === "cloud" ? localEntries.length : undefined; + const kindName = kind === "agent" ? "代理" : kind === "skill" ? "技能" : "命令行"; + const EntryIcon = kind === "agent" ? Bot : kind === "skill" ? Sparkles : TerminalSquare; + const sourceItems = [ - { - key: "local" as const, - label: "本地已安装", - trailing: kind === "agent" ? String(counts.localAgents) : String(counts.localSkills), - }, - { - description: `云端 ${kind === "agent" ? "Agent" : "Skill"} 尚未接入`, - key: "cloud" as const, - label: "云端预留", - }, + { key: "cloud" as const, label: "云端目录", trailing: cloudCount === undefined ? "" : String(cloudCount) }, + { key: "local" as const, label: "本地已安装", trailing: String(localCount) }, ]; return (