'use client'; import * as React from 'react'; import { FolderSearch } from 'lucide-react'; import { Table, TableBody, TableHead, TableHeader, TableRow, } from '@/components/ui/table'; import { FileItem } from '@/components/file-item'; import { FolderItem } from '@/components/folder-item'; import type { File as FileType, Folder as FolderType } from '@/app/api/files/route'; import { Checkbox } from './ui/checkbox'; import { cn } from '@/lib/utils'; interface FileListProps { files: FileType[]; folders: FolderType[]; searchTerm: string; onSelectFolder: (path: string) => void; selectedIds: string[]; onSelectAll: (isChecked: boolean) => void; onSelectItem: (id: string, isChecked: boolean) => void; allItemCount: number; isSelectionActive: boolean; isPublicShare?: boolean; } export function FileList({ files, folders, searchTerm, onSelectFolder, selectedIds, onSelectAll, onSelectItem, allItemCount, isSelectionActive, isPublicShare, }: FileListProps) { const hasItems = files.length > 0 || folders.length > 0; const [isAnimating, setIsAnimating] = React.useState(false); React.useEffect(() => { setIsAnimating(true); const timer = setTimeout(() => setIsAnimating(false), 500); return () => clearTimeout(timer); }, [files, folders]); const numSelected = selectedIds.length; const isAllSelected = allItemCount > 0 && numSelected === allItemCount; if (!hasItems) { return (
{searchTerm ? 'Try a different search term.' : 'There are no files or folders here.'}