"use client"; import { PanelRightClose, Plus } from "lucide-react"; import { Button } from "@/components/ui/button"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Sheet, SheetContent, SheetTitle } from "@/components/ui/sheet"; import type { ChatItem, NavItem, PageUsage, SearchSpace, User } from "../../types/layout.types"; import { SearchSpaceAvatar } from "../icon-rail/SearchSpaceAvatar"; import { Sidebar } from "./Sidebar"; interface MobileSidebarProps { isOpen: boolean; onOpenChange: (open: boolean) => void; searchSpaces: SearchSpace[]; activeSearchSpaceId: number | null; onSearchSpaceSelect: (id: number) => void; onSearchSpaceDelete?: (searchSpace: SearchSpace) => void; onSearchSpaceSettings?: (searchSpace: SearchSpace) => void; onAddSearchSpace: () => void; searchSpace: SearchSpace | null; navItems: NavItem[]; onNavItemClick?: (item: NavItem) => void; chats: ChatItem[]; sharedChats?: ChatItem[]; activeChatId?: number | null; onNewChat: () => void; onChatSelect: (chat: ChatItem) => void; onChatRename?: (chat: ChatItem) => void; onChatDelete?: (chat: ChatItem) => void; onChatArchive?: (chat: ChatItem) => void; onViewAllSharedChats?: () => void; onViewAllPrivateChats?: () => void; user: User; onSettings?: () => void; onManageMembers?: () => void; onUserSettings?: () => void; onLogout?: () => void; pageUsage?: PageUsage; theme?: string; setTheme?: (theme: "light" | "dark" | "system") => void; isLoadingChats?: boolean; } export function MobileSidebarTrigger({ onClick }: { onClick: () => void }) { return ( Open menu ); } export function MobileSidebar({ isOpen, onOpenChange, searchSpaces, activeSearchSpaceId, onSearchSpaceSelect, onSearchSpaceDelete, onSearchSpaceSettings, onAddSearchSpace, searchSpace, navItems, onNavItemClick, chats, sharedChats, activeChatId, onNewChat, onChatSelect, onChatRename, onChatDelete, onChatArchive, onViewAllSharedChats, onViewAllPrivateChats, user, onSettings, onManageMembers, onUserSettings, onLogout, pageUsage, theme, setTheme, isLoadingChats = false, }: MobileSidebarProps) { const handleSearchSpaceSelect = (id: number) => { onSearchSpaceSelect(id); }; const handleNavItemClick = (item: NavItem) => { onNavItemClick?.(item); onOpenChange(false); }; const handleChatSelect = (chat: ChatItem) => { onChatSelect(chat); onOpenChange(false); }; return ( Navigation {/* Vertical Search Spaces Rail - left side */} {searchSpaces.map((space) => ( 1} isOwner={space.isOwner} onClick={() => handleSearchSpaceSelect(space.id)} size="md" disableTooltip /> ))} Add search space {/* Sidebar Content - right side */} onOpenChange(false)} navItems={navItems} onNavItemClick={handleNavItemClick} chats={chats} sharedChats={sharedChats} activeChatId={activeChatId} onNewChat={() => { onNewChat(); onOpenChange(false); }} onChatSelect={handleChatSelect} onChatRename={onChatRename} onChatDelete={onChatDelete} onChatArchive={onChatArchive} onViewAllSharedChats={ onViewAllSharedChats ? () => { onOpenChange(false); onViewAllSharedChats(); } : undefined } onViewAllPrivateChats={ onViewAllPrivateChats ? () => { onOpenChange(false); onViewAllPrivateChats(); } : undefined } user={user} onSettings={onSettings} onManageMembers={onManageMembers} onUserSettings={onUserSettings} onLogout={onLogout} pageUsage={pageUsage} theme={theme} setTheme={setTheme} className="w-full border-none" isLoadingChats={isLoadingChats} disableTooltips /> ); }