diff --git a/components/file/upload.tsx b/components/file/upload.tsx index bbf72eb..6938651 100644 --- a/components/file/upload.tsx +++ b/components/file/upload.tsx @@ -15,12 +15,8 @@ import { useTranslations } from "next-intl"; import { cn, formatFileSize } from "@/lib/utils"; import { useFileUpload } from "@/hooks/use-file-upload"; - -import { BucketInfo, StorageUserPlan } from "."; -import { CopyButton } from "../shared/copy-button"; -import { Icons } from "../shared/icons"; -import { Badge } from "../ui/badge"; -import { Button } from "../ui/button"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; import { Drawer, DrawerClose, @@ -29,7 +25,11 @@ import { DrawerFooter, DrawerHeader, DrawerTitle, -} from "../ui/drawer"; +} from "@/components/ui/drawer"; +import { CopyButton } from "@/components/shared/copy-button"; +import { Icons } from "@/components/shared/icons"; + +import { BucketInfo, StorageUserPlan } from "."; import DragAndDrop from "./drag-and-drop"; export const FileUploader = ({ @@ -38,21 +38,15 @@ export const FileUploader = ({ plan, userId, onRefresh, - onUploadComplete, - onUploadError, }: { bucketInfo: BucketInfo; action: string; userId: string; plan?: StorageUserPlan; onRefresh: () => void; - onUploadComplete?: (files: any[]) => void; - onUploadError?: (error: string) => void; }) => { const t = useTranslations("Components"); const [isOpen, setIsOpen] = useState(false); - const [dragActive, setDragActive] = useState(false); - const fileInputRef = useRef(null); const [selectedFile, setSelectedFile] = useState(null); const { files, @@ -72,62 +66,6 @@ export const FileUploader = ({ } }, [selectedFile]); - // useEffect(() => { - // const completedFiles = files.filter((f) => f.status === "completed"); - // const errorFiles = files.filter((f) => f.status === "error"); - - // if (completedFiles.length > 0 && stats.uploading === 0 && !isUploading) { - // onUploadComplete?.(completedFiles); - // onRefresh(); - // } - - // if (errorFiles.length > 0 && stats.uploading === 0 && !isUploading) { - // const errors = errorFiles.map((f) => f.error || "未知错误").join(", "); - // onUploadError?.(errors); - // } - // }, [files, stats, isUploading, onUploadComplete, onUploadError]); - - const getFileIcon = (type: string) => { - if (type.startsWith("image/")) return ; - if (type.startsWith("video/")) return