import { Login } from "@/components/ui/login"; import { NextChatLogo } from "@/components/ui/nextchat-logo"; import { UserMenu } from "@/components/ui/user-menu"; import { db, chats } from "@/lib/db/schema"; import { cn } from "@/lib/utils"; import { type Session } from "@auth/nextjs/types"; import { eq } from "drizzle-orm"; import { Plus } from "lucide-react"; import { unstable_cache } from "next/cache"; import Link from "next/link"; import { SidebarItem } from "./sidebar-item"; export interface SidebarProps { session?: Session; newChat?: boolean; } export function Sidebar({ session, newChat }: SidebarProps) { return (
); } Sidebar.displayName = "Sidebar"; async function SidebarList({ session }: { session?: Session }) { const results: any[] = await ( await unstable_cache( () => db.query.chats.findMany({ columns: { id: true, title: true, }, where: eq(chats.userId, session?.user?.email || ""), }), // @ts-ignore [session?.user?.id || ""], { revalidate: 3600, } ) )(); return results.map((c) => ( )); }