// https://github.com/sadmann7/file-uploader 'use client'; import { FileText, Upload, X } from 'lucide-react'; import * as React from 'react'; import Dropzone, { type DropzoneProps, type FileRejection, } from 'react-dropzone'; import { toast } from 'sonner'; import { Button } from '@/components/ui/button'; import { Progress } from '@/components/ui/progress'; import { ScrollArea } from '@/components/ui/scroll-area'; import { useControllableState } from '@/hooks/use-controllable-state'; import { cn, formatBytes } from '@/lib/utils'; function isFileWithPreview(file: File): file is File & { preview: string } { return 'preview' in file && typeof file.preview === 'string'; } interface FileCardProps { file: File; onRemove: () => void; progress?: number; } interface FilePreviewProps { file: File & { preview: string }; } function FilePreview({ file }: FilePreviewProps) { if (file.type.startsWith('image/')) { return ( {file.name} ); } return (