'use client';
import { Download, Eye, FileText, Film, Image, MoreHorizontal, Pencil, Sheet, Trash2 } from 'lucide-react';
import { format } from 'date-fns';
import { Button } from '@/components/ui/button';
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import { Skeleton } from '@/components/ui/skeleton';
import { PREVIEWABLE_MIMES } from '@/lib/constants/file-validation';
export interface FileRow {
id: string;
filename: string;
originalName: string;
mimeType: string | null;
sizeBytes: string | null;
storagePath?: string;
category: string | null;
createdAt: string | Date;
uploadedBy: string;
}
interface FileGridProps {
files: FileRow[];
onDownload: (file: FileRow) => void;
onPreview: (file: FileRow) => void;
onRename: (file: FileRow) => void;
onDelete: (file: FileRow) => void;
isLoading?: boolean;
}
function formatBytes(bytes: string | null): string {
if (!bytes) return '';
const n = Number(bytes);
if (n < 1024) return `${n} B`;
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
return `${(n / (1024 * 1024)).toFixed(1)} MB`;
}
function FileIcon({ mimeType }: { mimeType: string | null }) {
if (!mimeType) return
No files yet
Upload files using the zone above
{file.filename}