@@ -30,23 +30,25 @@ import { usePathname } from "next/navigation";
3030import posthog from "posthog-js" ;
3131import { useEffect , useRef , useState } from "react" ;
3232import { AppearanceDropdownMenuGroup } from "../appearanceDropdownMenuGroup" ;
33+ import { NotificationDot } from "../notificationDot" ;
3334import { ChatHistoryItem , ChatHistorySidebarGroup } from "./chatHistorySidebarGroup" ;
3435import { useSidebarOverride } from "./sidebarOverrideContext" ;
3536
36- const items = [
37- { title : "Code Search" , href : "/search" , icon : SearchIcon } ,
38- { title : "Ask" , href : "/chat" , icon : MessageCircleIcon } ,
39- { title : "Chats" , href : "/chats" , icon : MessagesSquareIcon } ,
40- { title : "Repositories" , href : "/repos" , icon : BookMarkedIcon } ,
41- { title : "Settings" , href : "/settings" , icon : SettingsIcon } ,
37+ const baseItems = [
38+ { title : "Code Search" , href : "/search" , icon : SearchIcon , key : "search" } ,
39+ { title : "Ask" , href : "/chat" , icon : MessageCircleIcon , key : "chat" } ,
40+ { title : "Chats" , href : "/chats" , icon : MessagesSquareIcon , key : "chats" } ,
41+ { title : "Repositories" , href : "/repos" , icon : BookMarkedIcon , key : "repos" } ,
42+ { title : "Settings" , href : "/settings" , icon : SettingsIcon , key : "settings" } ,
4243] ;
4344
4445interface AppSidebarProps {
4546 session : Session | null ;
4647 chatHistory : ChatHistoryItem [ ] ;
48+ isSettingsNotificationVisible ?: boolean ;
4749}
4850
49- export function AppSidebar ( { session, chatHistory } : AppSidebarProps ) {
51+ export function AppSidebar ( { session, chatHistory, isSettingsNotificationVisible } : AppSidebarProps ) {
5052 const pathname = usePathname ( ) ;
5153 const [ isScrolled , setIsScrolled ] = useState ( false ) ;
5254 const contentRef = useRef < HTMLDivElement > ( null ) ;
@@ -91,16 +93,21 @@ export function AppSidebar({ session, chatHistory }: AppSidebarProps) {
9193 </ Link >
9294 { hasOverride ? sidebarOverride . override ?. header : (
9395 < SidebarMenu >
94- { items . map ( ( item ) => (
95- < SidebarMenuItem key = { item . title } >
96- < SidebarMenuButton asChild isActive = { isActive ( item . href ) } >
97- < a href = { item . href } >
98- < item . icon />
99- < span > { item . title } </ span >
100- </ a >
101- </ SidebarMenuButton >
102- </ SidebarMenuItem >
103- ) ) }
96+ { baseItems . map ( ( item ) => {
97+ const showNotification =
98+ ( item . key === "settings" && isSettingsNotificationVisible ) ;
99+ return (
100+ < SidebarMenuItem key = { item . title } >
101+ < SidebarMenuButton asChild isActive = { isActive ( item . href ) } >
102+ < a href = { item . href } >
103+ < item . icon />
104+ < span > { item . title } </ span >
105+ { showNotification && < NotificationDot className = "ml-1.5" /> }
106+ </ a >
107+ </ SidebarMenuButton >
108+ </ SidebarMenuItem >
109+ ) ;
110+ } ) }
104111 </ SidebarMenu >
105112 ) }
106113 </ SidebarHeader >
0 commit comments