()
| 43 | import { usePathname, useRouter } from "next/navigation"; |
| 44 | |
| 45 | export function AppSidebar() { |
| 46 | const pathname = usePathname(); |
| 47 | const router = useRouter(); |
| 48 | const { chats, isLoading, deleteChat } = useChatStore(); |
| 49 | |
| 50 | const handleDelete = async (chatId: string) => { |
| 51 | await deleteChat(chatId); |
| 52 | router.push("/chat"); |
| 53 | }; |
| 54 | |
| 55 | return ( |
| 56 | <Sidebar> |
| 57 | <SidebarHeader className="px-4 pt-4"> |
| 58 | <Logo /> |
| 59 | </SidebarHeader> |
| 60 | <SidebarContent> |
| 61 | <SidebarGroup> |
| 62 | <SidebarGroupLabel>Notes</SidebarGroupLabel> |
| 63 | <SidebarMenu className="mb-1"> |
| 64 | <SidebarMenuItem> |
| 65 | <SidebarMenuButton asChild isActive={pathname === "/"}> |
| 66 | <Link href="/"> |
| 67 | <Icons.notebookPen /> |
| 68 | <span>Journal</span> |
| 69 | </Link> |
| 70 | </SidebarMenuButton> |
| 71 | </SidebarMenuItem> |
| 72 | </SidebarMenu> |
| 73 | <SidebarMenu> |
| 74 | <SidebarMenuItem> |
| 75 | <SidebarMenuButton asChild isActive={pathname === "/knowledge"}> |
| 76 | <Link href="/knowledge"> |
| 77 | <Icons.bookOpenText /> |
| 78 | <span>Knowledge</span> |
| 79 | </Link> |
| 80 | </SidebarMenuButton> |
| 81 | </SidebarMenuItem> |
| 82 | </SidebarMenu> |
| 83 | </SidebarGroup> |
| 84 | <SidebarGroup> |
| 85 | <SidebarGroupLabel>AI</SidebarGroupLabel> |
| 86 | <SidebarMenu> |
| 87 | <Collapsible className="group/collapsible" defaultOpen={false}> |
| 88 | <SidebarMenuItem> |
| 89 | <SidebarMenuButton |
| 90 | isActive={pathname === "/chat"} |
| 91 | className="group/chat flex" |
| 92 | > |
| 93 | <div className="flex h-4 w-4 items-center justify-center"> |
| 94 | <Icons.botMessageSquare className="block transition-opacity duration-200 group-hover/chat:hidden" /> |
| 95 | <CollapsibleTrigger asChild> |
| 96 | <Icons.chevronRight className="-ml-1 hidden h-5 w-5 rounded transition-transform duration-200 hover:bg-neutral-200 group-hover/chat:block group-data-[state=open]/collapsible:rotate-90" /> |
| 97 | </CollapsibleTrigger> |
| 98 | </div> |
| 99 | <Link |
| 100 | href="/chat" |
| 101 | className="flex flex-1 items-center justify-between" |
| 102 | title="New chat" |
nothing calls this directly
no test coverage detected