"use client"; import { useRef, useState } from "react"; import { Upload, X } from "lucide-react"; import { cn } from "@/lib/utils"; interface UploadZoneProps { file: File | null; onFileSelect: (file: File) => void; onFileRemove: () => void; isDragging: boolean; onDragEnter: () => void; onDragLeave: () => void; isDisabled?: boolean; } export function UploadZone({ file, onFileSelect, onFileRemove, isDragging, onDragEnter, onDragLeave, isDisabled, }: UploadZoneProps) { const inputRef = useRef(null); const handleDragOver = (e: React.DragEvent) => { e.preventDefault(); }; const handleDrop = (e: React.DragEvent) => { e.preventDefault(); onDragLeave(); const droppedFile = e.dataTransfer.files?.[0]; if (droppedFile) { onFileSelect(droppedFile); } }; const handleInputChange = (e: React.ChangeEvent) => { const selectedFile = e.currentTarget.files?.[0]; if (selectedFile) { onFileSelect(selectedFile); } }; const handleClick = () => { if (!isDisabled) { inputRef.current?.click(); } }; if (file) { return (

{file.name}

{(file.size / 1024).toFixed(2)} KB

); } return (

Drag & Drop CAD Files Here

Supported: STEP, STP (Max 50MB)

); }