mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-08 07:03:22 +08:00
fix(skills): remove redundant navigation buttons in skills pages
- Remove duplicate "Repo Manager" button from installed skills view (should only appear in discovery view) - Remove redundant back button from SkillsPage component (header already provides unified navigation) - Clean up unused openRepoManagerOnDiscovery state and related useEffect - Remove unused onClose prop and ArrowLeft import from SkillsPage
This commit is contained in:
22
src/App.tsx
22
src/App.tsx
@@ -84,8 +84,6 @@ function App() {
|
||||
const promptPanelRef = useRef<any>(null);
|
||||
const mcpPanelRef = useRef<any>(null);
|
||||
const skillsPageRef = useRef<any>(null);
|
||||
const [openRepoManagerOnDiscovery, setOpenRepoManagerOnDiscovery] =
|
||||
useState(false);
|
||||
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";
|
||||
|
||||
@@ -122,13 +120,6 @@ function App() {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (currentView === "skillsDiscovery" && openRepoManagerOnDiscovery) {
|
||||
skillsPageRef.current?.openRepoManager?.();
|
||||
setOpenRepoManagerOnDiscovery(false);
|
||||
}
|
||||
}, [currentView, openRepoManagerOnDiscovery]);
|
||||
|
||||
// 🎯 使用 useProviderActions Hook 统一管理所有 Provider 操作
|
||||
const {
|
||||
addProvider,
|
||||
@@ -448,7 +439,6 @@ function App() {
|
||||
return (
|
||||
<SkillsPage
|
||||
ref={skillsPageRef}
|
||||
onClose={() => setCurrentView("skills")}
|
||||
initialApp={activeApp}
|
||||
/>
|
||||
);
|
||||
@@ -685,18 +675,6 @@ function App() {
|
||||
<Search className="w-4 h-4 mr-2" />
|
||||
{t("skills.discover")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
setOpenRepoManagerOnDiscovery(true);
|
||||
setCurrentView("skillsDiscovery");
|
||||
}}
|
||||
className="hover:bg-black/5 dark:hover:bg-white/5"
|
||||
>
|
||||
<Settings className="w-4 h-4 mr-2" />
|
||||
{t("skills.repoManager")}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{currentView === "skillsDiscovery" && (
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { RefreshCw, Search, ArrowLeft } from "lucide-react";
|
||||
import { RefreshCw, Search } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { SkillCard } from "./SkillCard";
|
||||
import { RepoManagerPanel } from "./RepoManagerPanel";
|
||||
@@ -26,7 +26,6 @@ import type { DiscoverableSkill, SkillRepo } from "@/lib/api/skills";
|
||||
import { formatSkillError } from "@/lib/errors/skillErrorParser";
|
||||
|
||||
interface SkillsPageProps {
|
||||
onClose?: () => void;
|
||||
initialApp?: AppType;
|
||||
}
|
||||
|
||||
@@ -40,7 +39,7 @@ export interface SkillsPageHandle {
|
||||
* 用于浏览和安装来自仓库的 Skills
|
||||
*/
|
||||
export const SkillsPage = forwardRef<SkillsPageHandle, SkillsPageProps>(
|
||||
({ onClose, initialApp = "claude" }, ref) => {
|
||||
({ initialApp = "claude" }, ref) => {
|
||||
const { t } = useTranslation();
|
||||
const [repoManagerOpen, setRepoManagerOpen] = useState(false);
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
@@ -194,21 +193,6 @@ export const SkillsPage = forwardRef<SkillsPageHandle, SkillsPageProps>(
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-[56rem] px-6 flex flex-col h-[calc(100vh-8rem)] overflow-hidden bg-background/50">
|
||||
{/* 返回按钮 */}
|
||||
{onClose && (
|
||||
<div className="flex-shrink-0 py-2">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={onClose}
|
||||
className="gap-2"
|
||||
>
|
||||
<ArrowLeft size={16} />
|
||||
{t("common.back")}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 技能网格(可滚动详情区域) */}
|
||||
<div className="flex-1 overflow-y-auto overflow-x-hidden animate-fade-in">
|
||||
<div className="py-4">
|
||||
|
||||
Reference in New Issue
Block a user