feat: unify plugin workspace navigation
This commit is contained in:
@@ -38,9 +38,7 @@ export function MainLayout() {
|
||||
const isPromptMuseum = location.pathname === '/image-prompts' || location.pathname.startsWith('/image-prompts/');
|
||||
const isChatWorkspace = location.pathname === '/chat';
|
||||
const isInitializationSafeRoute = location.pathname === '/project-config'
|
||||
|| location.pathname === '/project-plugins'
|
||||
|| location.pathname === '/plugin-marketplace'
|
||||
|| location.pathname === '/my-plugins'
|
||||
|| location.pathname === '/plugins'
|
||||
|| !isProgrammingModule;
|
||||
|
||||
const handleSidebarPeekChange = useCallback((open: boolean, source: SidebarPeekSource) => {
|
||||
|
||||
@@ -13,8 +13,6 @@ import {
|
||||
LogOut,
|
||||
Plus,
|
||||
Puzzle,
|
||||
Library,
|
||||
Store,
|
||||
Settings as SettingsIcon,
|
||||
UserCircle2,
|
||||
} from 'lucide-react';
|
||||
@@ -591,33 +589,18 @@ export function Sidebar({ workspaceLayout = false, sidebarPeekOpen = false, onSi
|
||||
<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')}
|
||||
data-testid="sidebar-nav-plugins"
|
||||
aria-current={location.pathname === '/plugins' ? 'page' : undefined}
|
||||
aria-label="插件"
|
||||
onClick={() => navigate(activeProject ? '/plugins?scope=project' : '/plugins?scope=all')}
|
||||
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',
|
||||
location.pathname === '/plugins' ? '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>
|
||||
<button
|
||||
type="button"
|
||||
data-testid="sidebar-nav-my-plugins"
|
||||
aria-current={location.pathname === '/my-plugins' ? 'page' : undefined}
|
||||
aria-label="我的插件"
|
||||
onClick={() => navigate('/my-plugins')}
|
||||
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 === '/my-plugins' ? 'bg-brand-selected text-foreground' : 'text-foreground hover:bg-surface-subtle',
|
||||
sidebarCollapsed && 'justify-center px-0',
|
||||
)}
|
||||
>
|
||||
<Library className="h-4 w-4 shrink-0 text-brand" />
|
||||
{!sidebarCollapsed ? <span>我的插件</span> : null}
|
||||
<Puzzle className="h-4 w-4 shrink-0 text-brand" />
|
||||
{!sidebarCollapsed ? <span>插件</span> : null}
|
||||
</button>
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
@@ -688,23 +671,6 @@ export function Sidebar({ workspaceLayout = false, sidebarPeekOpen = false, onSi
|
||||
</DisclosureContent>
|
||||
) : null}
|
||||
</div>
|
||||
{activeProject ? (
|
||||
<button
|
||||
type="button"
|
||||
data-testid="sidebar-nav-project-plugins"
|
||||
aria-current={location.pathname === '/project-plugins' ? 'page' : undefined}
|
||||
aria-label="项目插件"
|
||||
onClick={() => navigate('/project-plugins')}
|
||||
className={cn(
|
||||
'motion-press mt-3 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 === '/project-plugins' ? 'bg-brand-selected text-foreground' : 'text-foreground hover:bg-surface-subtle',
|
||||
sidebarCollapsed && 'justify-center px-0',
|
||||
)}
|
||||
>
|
||||
<Puzzle className="h-4 w-4 shrink-0 text-brand" />
|
||||
{!sidebarCollapsed ? <span>项目插件</span> : null}
|
||||
</button>
|
||||
) : null}
|
||||
</>
|
||||
) : isLearningModule ? (
|
||||
<LearningSidebar sidebarCollapsed={sidebarCollapsed} />
|
||||
|
||||
Reference in New Issue
Block a user