"use client" import { useState } from "react" import { useRouter } from "next/navigation" import { Menu, Plus, Search, X } from "lucide-react" import { Button } from "@/components/ui/button" import { DriveMobileSearchSheet } from "@/components/drive/drive-mobile-search-sheet" import { DriveNewSheet } from "@/components/drive/drive-new-sheet" import type { DriveFileInfo } from "@/lib/api/types" import { openDriveItem } from "@/lib/drive/drive-open-item" import { type DriveSearchScope, buildDriveSearchUrl, defaultDriveSearchScope, fileBrowserViewForSearchScope, } from "@/lib/drive/drive-search" import { useDriveRouteRoot } from "@/lib/drive/drive-route-context" import type { DriveView } from "@/lib/drive/drive-url" import { useDriveUIStore } from "@/lib/stores/drive-ui-store" const ROUNDED_BAR_BTN = "size-11 shrink-0 rounded-full border border-gray-200 bg-white/80 text-[#444746] shadow-md backdrop-blur hover:bg-white" export function DriveMobileBottomBar({ search, onSearchChange, searchScope, onSearchScopeChange, folderPath, contextView, resultsMode = false, parentPath, }: { search: string onSearchChange: (q: string) => void searchScope: DriveSearchScope onSearchScopeChange: (scope: DriveSearchScope) => void folderPath: string contextView: DriveView resultsMode?: boolean parentPath: string }) { const router = useRouter() const routeRoot = useDriveRouteRoot() const openPreview = useDriveUIStore((s) => s.openPreview) const sidebarCollapsed = useDriveUIStore((s) => s.sidebarCollapsed) const setSidebarCollapsed = useDriveUIStore((s) => s.setSidebarCollapsed) const sidebarOpen = !sidebarCollapsed const [searchOpen, setSearchOpen] = useState(false) const [newOpen, setNewOpen] = useState(false) const toggleSidebar = () => setSidebarCollapsed(!sidebarCollapsed) const effectiveScope = searchScope === "folder" && folderPath === "/" ? defaultDriveSearchScope(contextView, folderPath) : searchScope const submitSearch = () => { const q = search.trim() if (!q) return router.push( buildDriveSearchUrl( { query: q, scope: effectiveScope, folderPath: effectiveScope === "folder" ? folderPath : "/", }, routeRoot ) ) } const openSuggestion = (item: DriveFileInfo, contextItems: DriveFileInfo[]) => { openDriveItem(item, { router, openPreview, view: fileBrowserViewForSearchScope(effectiveScope), contextItems, }) } return ( <> setSearchOpen(false)} search={search} onSearchChange={onSearchChange} searchScope={searchScope} onSearchScopeChange={onSearchScopeChange} folderPath={folderPath} contextView={contextView} resultsMode={resultsMode} onPickItem={openSuggestion} onSubmitSearch={submitSearch} />
{!sidebarOpen && ( <> )}
) }