refactor(ui): extract shared components and deduplicate MCP/Skills panels (#897)

* refactor(ui): add tooltips and icons to MCP and Skills panels

* refactor: deduplicate UnifiedSkillsPanel and UnifiedMcpPanel shared code
This commit is contained in:
PeanutSplash
2026-02-04 10:10:45 +08:00
committed by GitHub
parent f0e8ba1d8f
commit e65360e68a
9 changed files with 254 additions and 302 deletions
+5 -5
View File
@@ -1,10 +1,10 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import {
skillsApi,
type AppType,
type DiscoverableSkill,
type InstalledSkill,
} from "@/lib/api/skills";
import type { AppId } from "@/lib/api/types";
/**
* 查询所有已安装的 Skills
@@ -38,7 +38,7 @@ export function useInstallSkill() {
currentApp,
}: {
skill: DiscoverableSkill;
currentApp: AppType;
currentApp: AppId;
}) => skillsApi.installUnified(skill, currentApp),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["skills", "installed"] });
@@ -73,7 +73,7 @@ export function useToggleSkillApp() {
enabled,
}: {
id: string;
app: AppType;
app: AppId;
enabled: boolean;
}) => skillsApi.toggleApp(id, app, enabled),
onSuccess: () => {
@@ -158,7 +158,7 @@ export function useInstallSkillsFromZip() {
currentApp,
}: {
filePath: string;
currentApp: AppType;
currentApp: AppId;
}) => skillsApi.installFromZip(filePath, currentApp),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["skills", "installed"] });
@@ -169,4 +169,4 @@ export function useInstallSkillsFromZip() {
// ========== 辅助类型 ==========
export type { InstalledSkill, DiscoverableSkill, AppType };
export type { InstalledSkill, DiscoverableSkill, AppId };