feat: enhance import/export functionality with detailed results dialog and improved data handling

This commit is contained in:
2026-05-15 11:34:23 +04:00
parent fcbba6247d
commit 54d11f01b4
18 changed files with 312 additions and 59 deletions
@@ -7,6 +7,7 @@ import { cn } from "@/shared/lib/utils"
export type ImageInputFieldProps = BaseFieldControlProps<File | null> & {
accept?: string
initialPreviewUrl?: string | null
}
export function ImageInputField({
@@ -17,21 +18,24 @@ export function ImageInputField({
disabled,
invalid,
accept = "image/*",
initialPreviewUrl,
}: ImageInputFieldProps) {
const inputRef = useRef<HTMLInputElement>(null)
const [preview, setPreview] = useState<string | null>(null)
const [filePreview, setFilePreview] = useState<string | null>(null)
const [isDragging, setIsDragging] = useState(false)
useEffect(() => {
if (!value) {
setPreview(null)
setFilePreview(null)
return
}
const url = URL.createObjectURL(value)
setPreview(url)
setFilePreview(url)
return () => URL.revokeObjectURL(url)
}, [value])
const preview = filePreview ?? initialPreviewUrl ?? null
const handleFile = useCallback(
(file: File | null) => {
if (file && !file.type.startsWith("image/")) return
@@ -110,7 +114,7 @@ export function ImageInputField({
alt="Preview"
className="max-h-30 max-w-full rounded-md object-contain"
/>
{!disabled && (
{!disabled && filePreview && (
<button
type="button"
onClick={handleClear}