diff --git a/frontend/collab-hub/components/dashboard/sidebar.tsx b/frontend/collab-hub/components/dashboard/sidebar.tsx
index 5a01c8c..cd6370d 100644
--- a/frontend/collab-hub/components/dashboard/sidebar.tsx
+++ b/frontend/collab-hub/components/dashboard/sidebar.tsx
@@ -1,6 +1,6 @@
"use client"
-import { useState } from "react"
+import { useMemo, useState } from "react"
import Link from "next/link"
import { usePathname } from "next/navigation"
import { Button } from "@/components/ui/button"
@@ -8,6 +8,7 @@ import { ScrollArea } from "@/components/ui/scroll-area"
import { Separator } from "@/components/ui/separator"
import { Badge } from "@/components/ui/badge"
import { useAuth } from "@/hooks/use-auth"
+import { useInvitations } from "@/hooks/use-invitations"
import {
Home,
FolderOpen,
@@ -20,6 +21,7 @@ import {
ChevronDown,
ChevronRight,
Mail,
+ Bell,
} from "lucide-react"
import { cn } from "@/lib/utils"
@@ -30,23 +32,31 @@ interface SidebarProps {
description: string
}>
onCreateProject: () => void
+ onNavigate?: () => void
+ className?: string
}
-export function Sidebar({ projects, onCreateProject }: SidebarProps) {
+export function Sidebar({ projects, onCreateProject, onNavigate, className }: SidebarProps) {
const pathname = usePathname()
const { user, logout } = useAuth()
+ const { data: invitations = [] } = useInvitations()
+ const pendingInvites = useMemo(
+ () => invitations.filter((invitation) => invitation.status === "PENDING").length,
+ [invitations],
+ )
const [isProjectsExpanded, setIsProjectsExpanded] = useState(true)
const navigation = [
{ name: "Dashboard", href: "/dashboard", icon: Home },
{ name: "My Tasks", href: "/dashboard/tasks", icon: CheckSquare },
{ name: "Messages", href: "/dashboard/messages", icon: MessageSquare },
- { name: "Invitations", href: "/dashboard/invitations", icon: Mail },
+ { name: "Notifications", href: "/dashboard/notifications", icon: Bell },
+ { name: "Invitations", href: "/dashboard/invitations", icon: Mail, badge: pendingInvites },
{ name: "Team", href: "/dashboard/team", icon: Users },
]
return (
-
+
{/* Header */}
@@ -70,9 +80,15 @@ export function Sidebar({ projects, onCreateProject }: SidebarProps) {
"w-full justify-start text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
isActive && "bg-sidebar-accent text-sidebar-accent-foreground",
)}
+ onClick={() => onNavigate?.()}
>
{item.name}
+ {item.badge ? (
+
+ {item.badge}
+
+ ) : null}
)
@@ -129,6 +145,7 @@ export function Sidebar({ projects, onCreateProject }: SidebarProps) {
"w-full justify-start text-xs text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
isActive && "bg-sidebar-accent text-sidebar-accent-foreground",
)}
+ onClick={() => onNavigate?.()}
>
{project.name}
@@ -145,6 +162,7 @@ export function Sidebar({ projects, onCreateProject }: SidebarProps) {
pathname === `/dashboard/projects/${project.id}/members` &&
"bg-sidebar-accent text-sidebar-accent-foreground",
)}
+ onClick={() => onNavigate?.()}
>
Members
@@ -174,14 +192,22 @@ export function Sidebar({ projects, onCreateProject }: SidebarProps) {
-