'use client'; import React, { useEffect, useRef } from 'react'; import { createRoot, Root } from 'react-dom/client'; import { X, Download, ArrowDownWideNarrow } from 'lucide-react'; interface DownloadOptionsModalProps { onDownloadCurrent: () => void; onDownloadAll: () => void; onClose: () => void; currentVideoIndex: number; totalVideos: number; /** 当前视频是否生成失败 */ isCurrentVideoFailed: boolean; /** 是否为最终视频阶段 */ isFinalStage?: boolean; } /** * Download options modal component with glass morphism style. * @param {DownloadOptionsModalProps} props - modal properties. */ function DownloadOptionsModal(props: DownloadOptionsModalProps) { const { onDownloadCurrent, onDownloadAll, onClose, currentVideoIndex, totalVideos, isCurrentVideoFailed, isFinalStage = false } = props; const containerRef = useRef(null); useEffect(() => { const originalOverflow = document.body.style.overflow; document.body.style.overflow = 'hidden'; return () => { document.body.style.overflow = originalOverflow; }; }, []); return (
e.stopPropagation()} >

Download Options

Choose your download preference

{!isCurrentVideoFailed && (
Current video
{currentVideoIndex + 1} / {totalVideos}
)}
{!isCurrentVideoFailed && ( )}
); } /** * Opens a download options modal with glass morphism style. * @param {DownloadOptionsModalProps} options - download options and callbacks. */ export function showDownloadOptionsModal(options: Omit): void { if (typeof window === 'undefined' || typeof document === 'undefined') { return; } const mount = document.createElement('div'); mount.setAttribute('data-alt', 'download-options-modal-root'); document.body.appendChild(mount); let root: Root | null = null; try { root = createRoot(mount); } catch { if (mount.parentNode) { mount.parentNode.removeChild(mount); } return; } const close = () => { try { root?.unmount(); } finally { if (mount.parentNode) { mount.parentNode.removeChild(mount); } } }; root.render( ); }