From 08935c8a8252889a119d5410fb229732320c72e0 Mon Sep 17 00:00:00 2001 From: ct Date: Thu, 3 Jul 2025 02:47:11 +0800 Subject: [PATCH] Update --- .../video-download/video-download-modal.jsx | 192 +++++++++++++++--- .../editor/partials/canvas/video-editor.jsx | 4 + .../editor/partials/canvas/video-export.jsx | 8 +- 3 files changed, 171 insertions(+), 33 deletions(-) diff --git a/resources/js/modules/editor/partials/canvas/video-download/video-download-modal.jsx b/resources/js/modules/editor/partials/canvas/video-download/video-download-modal.jsx index b70db1c..06e881e 100644 --- a/resources/js/modules/editor/partials/canvas/video-download/video-download-modal.jsx +++ b/resources/js/modules/editor/partials/canvas/video-download/video-download-modal.jsx @@ -1,47 +1,177 @@ import { Button } from '@/components/ui/button'; -import { Checkbox } from '@/components/ui/checkbox'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'; -import { Spinner } from '@/components/ui/spinner'; +import { Progress } from '@/components/ui/progress'; import { Textarea } from '@/components/ui/textarea'; +import { CheckCircle, Clock10Icon, Download, Droplets } from 'lucide-react'; import { useState } from 'react'; -const VideoDownloadModal = ({ isOpen, onClose, ffmpegCommand, handleDownloadButton, isExporting, exportProgress, exportStatus }) => { +const VideoDownloadModal = ({ + nonWatermarkVideosLeft = 0, + isOpen, + onClose, + ffmpegCommand, + handleDownloadButton, + isExporting, + exportProgress, + exportStatus, +}) => { const [showDebug, setShowDebug] = useState(false); + const [exportType, setExportType] = useState(null); + + const handleExportWithoutWatermark = () => { + setExportType('without'); + handleDownloadButton(); + }; + + const handleExportWithWatermark = () => { + setExportType('with'); + handleDownloadButton(); + }; + + const handleClose = () => { + onClose(); + setTimeout(() => { + setExportType(null); + }, 300); + }; + + const isComplete = exportProgress >= 100 && !isExporting; + + const exportTimes = [ + { + icon: '🐇', + label: 'Modern and fast devices', + time: '1-2 mins', + }, + { + icon: '🐢', + label: 'Medium range devices', + time: '3-5 mins', + }, + { + icon: '🥔', + label: 'Older / potato devices', + time: '>5 mins', + }, + ]; return ( - - - - Export Video - {exportStatus || - (exportProgress > 0 && ( - -
-
- {exportStatus} - {exportProgress}% -
- -
-
- ))} + + isExporting && e.preventDefault()} + onEscapeKeyDown={(e) => isExporting && e.preventDefault()} + > + + Export Video + -
- - -
+ {!isExporting && !isComplete && ( +
+
+
+
+

+ Estimated export time +

+
+ {exportTimes.map((exportTime, index) => ( +
+
+ {exportTime.icon} + {exportTime.label} +
+ {exportTime.time} +
+ ))} +
+
+
+
- {showDebug &&