'use client' import Image from 'next/image' import { Plus } from 'lucide-react' import { PREVIEW_OPTIONAL_TYPES } from './upload-constants' import { dropZoneActiveClass, dropZoneIdleClass, fieldHintClass, fieldLabelClass, uploadAreaAddTileClass, uploadAreaEmptyButtonClass, uploadAreaTileClass, } from './upload-field-styles' import VideoPreviewImageUpload from './VideoPreviewImageUpload' import { isVideoMaterialType } from '@/lib/video-material-types' interface PreviewImageUploadProps { materialType: string previewImages: File[] previewUrls: string[] isPreviewDragging: boolean previewInputRef: React.RefObject previewDropZoneRef: React.RefObject disabled?: boolean onPreviewChange: (e: React.ChangeEvent) => void onPreviewDragEnter: (e: React.DragEvent) => void onPreviewDragLeave: (e: React.DragEvent) => void onPreviewDragOver: (e: React.DragEvent) => void onPreviewDrop: (e: React.DragEvent) => void onRemovePreviewImage: (index: number) => void onVideoPreviewSelect: (file: File) => void | Promise onValidationError: (message: string) => void onVideoPreviewProcessingChange?: (processing: boolean) => void } export default function PreviewImageUpload({ materialType, previewImages, previewUrls, isPreviewDragging, previewInputRef, previewDropZoneRef, disabled = false, onPreviewChange, onPreviewDragEnter, onPreviewDragLeave, onPreviewDragOver, onPreviewDrop, onRemovePreviewImage, onVideoPreviewSelect, onValidationError, onVideoPreviewProcessingChange, }: PreviewImageUploadProps) { if (isVideoMaterialType(materialType)) { return ( onRemovePreviewImage(0)} onValidationError={onValidationError} onProcessingChange={onVideoPreviewProcessingChange} /> ) } return (
0 ? 'flex flex-wrap gap-2' : ''}> {previewUrls.map((url, index) => (
{`预览图 {index === 0 && (
主图
)}
))}

JPG、PNG、WebP · 可多选或拖入 · 首张为主预览图

) }