fix: Delete ai comments
This commit is contained in:
@@ -28,9 +28,8 @@ export const VideoPreviewCard: React.FC<VideoPreviewCardProps> = ({
|
||||
const token = localStorage.getItem("token");
|
||||
|
||||
useEffect(() => {}, [isDragOver]);
|
||||
// --- Click to select file ---
|
||||
|
||||
const handleZoneClick = () => {
|
||||
// Trigger the hidden file input click
|
||||
fileInputRef.current?.click();
|
||||
};
|
||||
|
||||
@@ -40,19 +39,17 @@ export const VideoPreviewCard: React.FC<VideoPreviewCardProps> = ({
|
||||
const file = event.target.files?.[0];
|
||||
if (file) {
|
||||
if (file.type.startsWith("video/")) {
|
||||
// Открываем диалог загрузки медиа с файлом видео
|
||||
onSelectVideoClick(file);
|
||||
} else {
|
||||
toast.error("Пожалуйста, выберите видео файл");
|
||||
}
|
||||
}
|
||||
// Reset the input value so selecting the same file again triggers change
|
||||
|
||||
event.target.value = "";
|
||||
};
|
||||
|
||||
// --- Drag and Drop Handlers ---
|
||||
const handleDragOver = (event: DragEvent<HTMLDivElement>) => {
|
||||
event.preventDefault(); // Crucial to allow a drop
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setIsDragOver(true);
|
||||
};
|
||||
@@ -64,7 +61,7 @@ export const VideoPreviewCard: React.FC<VideoPreviewCardProps> = ({
|
||||
};
|
||||
|
||||
const handleDrop = async (event: DragEvent<HTMLDivElement>) => {
|
||||
event.preventDefault(); // Crucial to allow a drop
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setIsDragOver(false);
|
||||
|
||||
@@ -72,7 +69,6 @@ export const VideoPreviewCard: React.FC<VideoPreviewCardProps> = ({
|
||||
if (files && files.length > 0) {
|
||||
const file = files[0];
|
||||
if (file.type.startsWith("video/")) {
|
||||
// Открываем диалог загрузки медиа с файлом видео
|
||||
onSelectVideoClick(file);
|
||||
} else {
|
||||
toast.error("Пожалуйста, выберите видео файл");
|
||||
@@ -175,7 +171,7 @@ export const VideoPreviewCard: React.FC<VideoPreviewCardProps> = ({
|
||||
borderRadius: 1,
|
||||
cursor: "pointer",
|
||||
}}
|
||||
onClick={handleZoneClick} // Click handler for the zone
|
||||
onClick={handleZoneClick}
|
||||
onDragOver={handleDragOver}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={handleDrop}
|
||||
@@ -189,8 +185,8 @@ export const VideoPreviewCard: React.FC<VideoPreviewCardProps> = ({
|
||||
color="primary"
|
||||
startIcon={<Plus color="white" size={18} />}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation(); // Prevent `handleZoneClick` from firing
|
||||
onSelectVideoClick(); // This button triggers the media selection dialog
|
||||
e.stopPropagation();
|
||||
onSelectVideoClick();
|
||||
}}
|
||||
>
|
||||
Выбрать файл
|
||||
@@ -201,7 +197,7 @@ export const VideoPreviewCard: React.FC<VideoPreviewCardProps> = ({
|
||||
ref={fileInputRef}
|
||||
onChange={handleFileInputChange}
|
||||
style={{ display: "none" }}
|
||||
accept="video/*" // Accept only video files
|
||||
accept="video/*"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user