From fce95d67eb7924e3a2505a4c24c05582a8963db4 Mon Sep 17 00:00:00 2001 From: TheShigure7 <2947458856@qq.com> Date: Sat, 9 May 2026 21:40:27 +0800 Subject: [PATCH 1/2] feat: connect market UI to cloud directory search --- ui/src/features/market/MarketSidebar.tsx | 125 +-- .../market/useMarketDirectory.test.tsx | 510 ++++++++-- ui/src/features/market/useMarketDirectory.ts | 563 +++++++++-- ui/src/pages/Market/MarketPage.tsx | 893 +++++++++++++----- 4 files changed, 1640 insertions(+), 451 deletions(-) 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 (