diff --git a/apps/web/components/layout/Sidebar.tsx b/apps/web/components/layout/Sidebar.tsx
index 20cac0c..d0fbb7c 100644
--- a/apps/web/components/layout/Sidebar.tsx
+++ b/apps/web/components/layout/Sidebar.tsx
@@ -1,11 +1,13 @@
'use client';
import { usePathname, useRouter } from 'next/navigation';
-import { Inbox, Package, FolderKanban, Tag, Users, LayoutGrid, Search, Lightbulb, Clock, Shield, Settings, Sparkles, TriangleAlert } from 'lucide-react';
+import { Inbox, Package, FolderKanban, Tag, Users, LayoutGrid, Lightbulb, Clock, Shield, Settings, Sparkles, TriangleAlert } from 'lucide-react';
import { useHasPermission } from '@/components/auth/Guard';
import { useXiaobaoWarningRisks } from '@/hooks/useXiaobaoWarningRisks';
+import { useWorkspaceWorkItems } from '@/hooks/useWorkspaceWorkItems';
import { useAuthStore } from '@/stores/useAuthStore';
import { useMemberStore } from '@/stores/useMemberStore';
+import { getWorkspacePendingCount } from '@/lib/workspace-engine';
import { getXiaobaoWarningRiskCount } from '@/lib/xiaobao-warning-view';
type NavItemConfig = {
@@ -13,7 +15,7 @@ type NavItemConfig = {
path: string;
icon: any;
permission: string | null;
- badge?: 'xiaobao-risk';
+ badge?: 'xiaobao-risk' | 'workspace-pending';
};
const NAV_GROUPS = [
@@ -21,7 +23,7 @@ const NAV_GROUPS = [
label: '工作区',
items: [
{ label: '小宝预警', path: '/xiaobao-warning', icon: TriangleAlert, permission: 'xiaobao.warning:view', badge: 'xiaobao-risk' as const },
- { label: '与我相关', path: '/workspace', icon: Inbox, permission: null as string | null },
+ { label: '与我相关', path: '/workspace', icon: Inbox, permission: null as string | null, badge: 'workspace-pending' as const },
{ label: '产品', path: '/products', icon: Package, permission: 'product:view' },
{ label: '项目', path: '/projects', icon: FolderKanban, permission: 'project:view' },
{ label: '版本', path: '/versions', icon: Tag, permission: 'version:view' },
@@ -42,36 +44,40 @@ const NAV_GROUPS = [
export function Sidebar() {
const pathname = usePathname();
const router = useRouter();
+ const { workItems } = useWorkspaceWorkItems();
+ const workspacePendingCount = getWorkspacePendingCount(workItems);
const isActive = (path: string) =>
pathname === path || (path !== '/' && pathname.startsWith(path));
return (
-