"use client" /** * LeoSidebarDrillInPanel — body rendered inside `SidebarDrillIn` when * the user is on `//leo`. Replaces the default `SidebarDrillInItems` * (which renders a static `NavLinkItem[]`) with a Leo-specific stack: * * • Search input — filters recents inline (no commit, no network) * • "New chat" button — resets the canvas via `dispatchLeoNewChat()` * • Recents list — newest first, click to re-ask, X to delete * * Recents are persisted per product (`lib/leo-recents.ts`); search is * session-only. The panel is rendered in expanded sidebar mode only — * icon-collapsed mode keeps the Ask Leo nav glyph as the affordance. */ import * as React from "react" import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar, } from "@/components/ui/sidebar" import { Button } from "@/components/ui/button" import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip" import { dispatchLeoNewChat } from "@/components/leo-landing-client" import { SidebarDrillInSearchField } from "@/components/sidebar/sidebar-drill-in-search-field" import { useLeoRecents, formatLeoRecentTime } from "@/lib/leo-recents" import { cn } from "@/lib/utils" export function LeoSidebarDrillInPanel() { const { recents, remove } = useLeoRecents() const [filter, setFilter] = React.useState("") const filterRef = React.useRef(null) const { state } = useSidebar() const expanded = state === "expanded" const filtered = React.useMemo(() => { const q = filter.trim().toLowerCase() if (!q) return recents return recents.filter((r) => r.prompt.toLowerCase().includes(q)) }, [recents, filter]) // Icon-collapsed mode — search becomes a menu icon; new chat stays icon-only too. if (!expanded) { return ( <> { dispatchLeoNewChat() setFilter("") }} >