'use client'; import { memo } from 'react'; import { AlertCircle, CheckCircle2, FileVideo, Link as LinkIcon, Loader2, Plus, UploadCloud } from 'lucide-react'; import { toast } from 'sonner'; import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'; import type { VideoSource } from '@/lib/video-providers'; interface VersionActionsDialogProps { open: boolean; onOpenChange: (open: boolean) => void; bunnyUploadsEnabled: boolean; newVersionMode: 'url' | 'file'; onNewVersionModeChange: (mode: 'url' | 'file') => void; newVersionUrl: string; onNewVersionUrlChange: (url: string) => void; newVersionUrlError: string; newVersionSource: VideoSource | null; newVersionFile: File | null; onNewVersionFileChange: (file: File | null) => void; newVersionLabel: string; onNewVersionLabelChange: (label: string) => void; newVersionUploadStatus: string; newVersionUploadProgress: number; isCreatingVersion: boolean; versionsCount: number; onCreateVersion: () => void; } export const VersionActionsDialog = memo(function VersionActionsDialog({ open, onOpenChange, bunnyUploadsEnabled, newVersionMode, onNewVersionModeChange, newVersionUrl, onNewVersionUrlChange, newVersionUrlError, newVersionSource, newVersionFile, onNewVersionFileChange, newVersionLabel, onNewVersionLabelChange, newVersionUploadStatus, newVersionUploadProgress, isCreatingVersion, versionsCount, onCreateVersion, }: VersionActionsDialogProps) { return ( Add New Version Upload a new version of this video. The new version will become active.
onNewVersionModeChange(v as 'url' | 'file')} className="mb-2"> Link URL {bunnyUploadsEnabled ? Upload File : null} {newVersionMode === 'url' ? (
onNewVersionUrlChange(e.target.value)} className="pl-10" disabled={isCreatingVersion} />
{newVersionUrlError && (

{newVersionUrlError}

)} {newVersionSource && (

{newVersionSource.providerId.charAt(0).toUpperCase() + newVersionSource.providerId.slice(1)}{' '} video detected

)}
) : (
)}
onNewVersionLabelChange(e.target.value)} disabled={isCreatingVersion} />
{newVersionUploadStatus && (

{newVersionUploadStatus}

{newVersionUploadProgress > 0 && newVersionUploadProgress < 100 && (
)}
)}
); });