diff --git a/src/App.tsx b/src/App.tsx index db2abe7d2..8ee1b9150 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -14,6 +14,7 @@ import { Server, RefreshCw, Search, + Download, } from "lucide-react"; import type { Provider } from "@/types"; import type { EnvConflict } from "@/types/env"; @@ -84,6 +85,7 @@ function App() { const promptPanelRef = useRef(null); const mcpPanelRef = useRef(null); const skillsPageRef = useRef(null); + const unifiedSkillsPanelRef = useRef(null); const addActionButtonClass = "bg-orange-500 hover:bg-orange-600 dark:bg-orange-500 dark:hover:bg-orange-600 text-white shadow-lg shadow-orange-500/30 dark:shadow-orange-500/40 rounded-full w-8 h-8"; @@ -423,6 +425,7 @@ function App() { case "skills": return ( setCurrentView("skillsDiscovery")} /> ); @@ -647,15 +650,26 @@ function App() { )} {currentView === "skills" && ( - + <> + + + )} {currentView === "skillsDiscovery" && ( <> diff --git a/src/components/skills/UnifiedSkillsPanel.tsx b/src/components/skills/UnifiedSkillsPanel.tsx index fe761f547..052ce2033 100644 --- a/src/components/skills/UnifiedSkillsPanel.tsx +++ b/src/components/skills/UnifiedSkillsPanel.tsx @@ -1,6 +1,6 @@ import React, { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; -import { Sparkles, Trash2, ExternalLink, Download } from "lucide-react"; +import { Sparkles, Trash2, ExternalLink } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Switch } from "@/components/ui/switch"; import { @@ -26,6 +26,7 @@ interface UnifiedSkillsPanelProps { */ export interface UnifiedSkillsPanelHandle { openDiscovery: () => void; + openImport: () => void; } const UnifiedSkillsPanel = React.forwardRef< @@ -98,7 +99,11 @@ const UnifiedSkillsPanel = React.forwardRef< const handleOpenImport = async () => { try { - await scanUnmanaged(); + const result = await scanUnmanaged(); + if (!result.data || result.data.length === 0) { + toast.success(t("skills.noUnmanagedFound"), { closeButton: true }); + return; + } setImportDialogOpen(true); } catch (error) { toast.error(t("common.error"), { @@ -124,6 +129,7 @@ const UnifiedSkillsPanel = React.forwardRef< React.useImperativeHandle(ref, () => ({ openDiscovery: onOpenDiscovery, + openImport: handleOpenImport, })); return ( @@ -152,18 +158,9 @@ const UnifiedSkillsPanel = React.forwardRef<

{t("skills.noInstalled")}

-

+

{t("skills.noInstalledDescription")}

-
- - -
) : (
@@ -369,22 +366,6 @@ const ImportSkillsDialog: React.FC = ({ onImport(Array.from(selected)); }; - if (skills.length === 0) { - return ( -
-
-

{t("skills.import")}

-

- {t("skills.noUnmanagedFound")} -

-
- -
-
-
- ); - } - return (