"use client" import { ArrowLeft } from "lucide-react" import { Button } from "@/components/ui/button" import { DriveSearchBar } from "@/components/drive/drive-search-bar" import { DriveSearchSuggestionsPanel } from "@/components/drive/drive-search-suggestions" import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@/components/ui/sheet" import type { DriveFileInfo } from "@/lib/api/types" import { useDriveSearchSuggestions } from "@/lib/api/hooks/use-drive-queries" import { type DriveSearchScope, defaultDriveSearchScope, } from "@/lib/drive/drive-search" import type { DriveView } from "@/lib/drive/drive-url" import { useDebouncedValue } from "@/lib/hooks/use-debounced-value" import { DRIVE_DIALOG_DIVIDER, DRIVE_SHEET_CONTENT, DRIVE_SHEET_OVERLAY, DRIVE_TEXT_SECONDARY, } from "@/lib/drive/drive-dialog-styles" import { cn } from "@/lib/utils" export function DriveMobileSearchSheet({ open, onClose, search, onSearchChange, searchScope, onSearchScopeChange, folderPath, contextView, resultsMode = false, onPickItem, onSubmitSearch, }: { open: boolean onClose: () => void search: string onSearchChange: (q: string) => void searchScope: DriveSearchScope onSearchScopeChange: (scope: DriveSearchScope) => void folderPath: string contextView: DriveView resultsMode?: boolean onPickItem: (item: DriveFileInfo, contextItems: DriveFileInfo[]) => void onSubmitSearch: () => void }) { const showFolderScope = folderPath !== "/" const effectiveScope = searchScope === "folder" && !showFolderScope ? defaultDriveSearchScope(contextView, folderPath) : searchScope const searchPath = effectiveScope === "folder" ? folderPath : "/" const debouncedQuery = useDebouncedValue(search, 250) const { data, isFetching } = useDriveSearchSuggestions( debouncedQuery, effectiveScope, searchPath, open && !resultsMode && debouncedQuery.trim().length >= 2 ) const suggestions = data?.files ?? [] return ( { if (!isOpen) onClose() }}> Rechercher dans Drive Rechercher des fichiers et dossiers dans Drive.
{search.trim().length >= 2 ? ( { onPickItem(item, suggestions) onClose() }} onSubmitSearch={() => { onSubmitSearch() onClose() }} className="static rounded-xl shadow-none" /> ) : (

Recherchez des fichiers et dossiers dans tout le Drive.

)}
) }