feat: move plugin center into project configuration
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
FolderKanban,
|
||||
LogOut,
|
||||
Plus,
|
||||
Store,
|
||||
Settings as SettingsIcon,
|
||||
UserCircle2,
|
||||
} from 'lucide-react';
|
||||
@@ -586,23 +585,6 @@ export function Sidebar({ workspaceLayout = false, sidebarPeekOpen = false, onSi
|
||||
<Plus className="h-4 w-4 shrink-0 text-brand" />
|
||||
{!sidebarCollapsed && '新建项目'}
|
||||
</button>
|
||||
<div className="mt-3 grid gap-1">
|
||||
<button
|
||||
type="button"
|
||||
data-testid="sidebar-nav-plugin-marketplace"
|
||||
aria-current={location.pathname === '/plugin-marketplace' ? 'page' : undefined}
|
||||
aria-label="插件中心"
|
||||
onClick={() => navigate('/plugin-marketplace')}
|
||||
className={cn(
|
||||
'motion-press flex min-h-10 w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm font-medium transition-colors duration-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/35',
|
||||
location.pathname === '/plugin-marketplace' ? 'bg-brand-selected text-foreground' : 'text-foreground hover:bg-surface-subtle',
|
||||
sidebarCollapsed && 'justify-center px-0',
|
||||
)}
|
||||
>
|
||||
<Store className="h-4 w-4 shrink-0 text-brand" />
|
||||
{!sidebarCollapsed ? <span>插件中心</span> : null}
|
||||
</button>
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
<button
|
||||
type="button"
|
||||
|
||||
50
src/components/plugins/PluginServices.tsx
Normal file
50
src/components/plugins/PluginServices.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
import { MyPlugins } from '@/pages/MyPlugins';
|
||||
import { PluginMarketplaceCatalog } from '@/pages/PluginMarketplace';
|
||||
import { ProjectPlugins } from '@/pages/ProjectPlugins';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { getPluginServiceTab, type PluginServiceTab } from '@/lib/plugin-services';
|
||||
|
||||
type PluginServicesProps = {
|
||||
value: PluginServiceTab;
|
||||
onValueChange(value: PluginServiceTab): void;
|
||||
onProjectPluginsChanged(): void;
|
||||
onManageAgents(): void;
|
||||
onResolveIdentity(): void;
|
||||
};
|
||||
|
||||
export function PluginServices({
|
||||
value,
|
||||
onValueChange,
|
||||
onProjectPluginsChanged,
|
||||
onManageAgents,
|
||||
onResolveIdentity,
|
||||
}: PluginServicesProps) {
|
||||
return (
|
||||
<Tabs
|
||||
data-testid="plugin-services"
|
||||
value={value}
|
||||
onValueChange={(next) => onValueChange(getPluginServiceTab(next))}
|
||||
className="min-w-0"
|
||||
>
|
||||
<TabsList aria-label="插件服务内容" className="grid w-full max-w-lg grid-cols-3">
|
||||
<TabsTrigger value="discover">发现插件</TabsTrigger>
|
||||
<TabsTrigger value="mine">我的插件</TabsTrigger>
|
||||
<TabsTrigger value="project">项目启用</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="discover" className="mt-6">
|
||||
<PluginMarketplaceCatalog embedded />
|
||||
</TabsContent>
|
||||
<TabsContent value="mine" className="mt-6">
|
||||
<MyPlugins embedded />
|
||||
</TabsContent>
|
||||
<TabsContent value="project" className="mt-6">
|
||||
<ProjectPlugins
|
||||
embedded
|
||||
onChanged={onProjectPluginsChanged}
|
||||
onManageAgents={onManageAgents}
|
||||
onResolveIdentity={onResolveIdentity}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user