66 MoveUpRight ,
77 Database ,
88 MessageCircle ,
9+ Settings2 ,
10+ Compass ,
911} from "lucide-react" ;
1012import Link from "next/link" ;
1113import { usePathname } from "next/navigation" ;
@@ -22,15 +24,16 @@ import {
2224 SidebarMenuItem ,
2325 SidebarHeader ,
2426} from "@/components/ui/sidebar" ;
25- // Extracted Chat Playground item
26- const chatPlaygroundItem = {
27- title : "Chat Playground" ,
28- url : "/chat-playground" ,
29- icon : MessageCircle ,
30- } ;
3127
32- // Removed Chat Playground from log items
33- const logItems = [
28+ const createItems = [
29+ {
30+ title : "Chat Playground" ,
31+ url : "/chat-playground" ,
32+ icon : MessageCircle ,
33+ } ,
34+ ] ;
35+
36+ const manageItems = [
3437 {
3538 title : "Chat Completions" ,
3639 url : "/logs/chat-completions" ,
@@ -53,77 +56,96 @@ const logItems = [
5356 } ,
5457] ;
5558
59+ const optimizeItems : { title : string ; url : string ; icon : React . ElementType } [ ] = [
60+ {
61+ title : "Evaluations" ,
62+ url : "" ,
63+ icon : Compass ,
64+ } ,
65+ {
66+ title : "Fine-tuning" ,
67+ url : "" ,
68+ icon : Settings2 ,
69+ } ,
70+ ] ;
71+
72+ interface SidebarItem {
73+ title : string ;
74+ url : string ;
75+ icon : React . ElementType ;
76+ }
77+
5678export function AppSidebar ( ) {
5779 const pathname = usePathname ( ) ;
5880
59- return (
60- < Sidebar >
61- < SidebarHeader >
62- < Link href = "/" > Llama Stack</ Link >
63- </ SidebarHeader >
64- < SidebarContent >
65- { /* Chat Playground as its own section */ }
66- < SidebarGroup >
67- < SidebarGroupContent >
68- < SidebarMenu >
69- < SidebarMenuItem >
81+ const renderSidebarItems = ( items : SidebarItem [ ] ) => {
82+ return items . map ( ( item ) => {
83+ const isActive = pathname . startsWith ( item . url ) ;
84+ return (
85+ < SidebarMenuItem key = { item . title } >
86+ < SidebarMenuButton
87+ asChild
88+ className = { cn (
89+ "justify-start" ,
90+ isActive &&
91+ "bg-gray-200 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-900 dark:text-gray-100" ,
92+ ) }
93+ >
94+ < Link href = { item . url } >
95+ < item . icon
96+ className = { cn (
97+ isActive && "text-gray-900 dark:text-gray-100" ,
98+ "mr-2 h-4 w-4" ,
99+ ) }
100+ />
101+ < span > { item . title } </ span >
102+ </ Link >
103+ </ SidebarMenuButton >
104+ </ SidebarMenuItem >
105+ ) ;
106+ } ) ;
107+ } ;
108+
109+ return (
110+ < Sidebar >
111+ < SidebarHeader >
112+ < Link href = "/" > Llama Stack</ Link >
113+ </ SidebarHeader >
114+ < SidebarContent >
115+ < SidebarGroup >
116+ < SidebarGroupLabel > Create</ SidebarGroupLabel >
117+ < SidebarGroupContent >
118+ < SidebarMenu > { renderSidebarItems ( createItems ) } </ SidebarMenu >
119+ </ SidebarGroupContent >
120+ </ SidebarGroup >
121+
122+ < SidebarGroup >
123+ < SidebarGroupLabel > Manage</ SidebarGroupLabel >
124+ < SidebarGroupContent >
125+ < SidebarMenu > { renderSidebarItems ( manageItems ) } </ SidebarMenu >
126+ </ SidebarGroupContent >
127+ </ SidebarGroup >
128+
129+ < SidebarGroup >
130+ < SidebarGroupLabel > Optimize</ SidebarGroupLabel >
131+ < SidebarGroupContent >
132+ < SidebarMenu >
133+ { optimizeItems . map ( ( item ) => (
134+ < SidebarMenuItem key = { item . title } >
70135 < SidebarMenuButton
71- asChild
72- className = { cn (
73- "justify-start" ,
74- pathname . startsWith ( chatPlaygroundItem . url ) &&
75- "bg-gray-200 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-900 dark:text-gray-100" ,
76- ) }
136+ disabled
137+ className = "justify-start opacity-60 cursor-not-allowed"
77138 >
78- < Link href = { chatPlaygroundItem . url } >
79- < chatPlaygroundItem . icon
80- className = { cn (
81- pathname . startsWith ( chatPlaygroundItem . url ) && "text-gray-900 dark:text-gray-100" ,
82- "mr-2 h-4 w-4" ,
83- ) }
84- />
85- < span > { chatPlaygroundItem . title } </ span >
86- </ Link >
139+ < item . icon className = "mr-2 h-4 w-4" />
140+ < span > { item . title } </ span >
141+ < span className = "ml-2 text-xs text-gray-500" > (Coming Soon)</ span >
87142 </ SidebarMenuButton >
88143 </ SidebarMenuItem >
89- </ SidebarMenu >
90- </ SidebarGroupContent >
91- </ SidebarGroup >
92-
93- { /* Logs section */ }
94- < SidebarGroup >
95- < SidebarGroupLabel > Logs</ SidebarGroupLabel >
96- < SidebarGroupContent >
97- < SidebarMenu >
98- { logItems . map ( ( item ) => {
99- const isActive = pathname . startsWith ( item . url ) ;
100- return (
101- < SidebarMenuItem key = { item . title } >
102- < SidebarMenuButton
103- asChild
104- className = { cn (
105- "justify-start" ,
106- isActive &&
107- "bg-gray-200 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-900 dark:text-gray-100" ,
108- ) }
109- >
110- < Link href = { item . url } >
111- < item . icon
112- className = { cn (
113- isActive && "text-gray-900 dark:text-gray-100" ,
114- "mr-2 h-4 w-4" ,
115- ) }
116- />
117- < span > { item . title } </ span >
118- </ Link >
119- </ SidebarMenuButton >
120- </ SidebarMenuItem >
121- ) ;
122- } ) }
123- </ SidebarMenu >
124- </ SidebarGroupContent >
125- </ SidebarGroup >
126- </ SidebarContent >
127- </ Sidebar >
144+ ) ) }
145+ </ SidebarMenu >
146+ </ SidebarGroupContent >
147+ </ SidebarGroup >
148+ </ SidebarContent >
149+ </ Sidebar >
128150 ) ;
129151}
0 commit comments