'use client'; import * as React from 'react'; import { AlertTriangle, Info, X } from 'lucide-react'; import { Modal } from '@/components/ui/Modal'; import { Button } from '@/components/ui/Button'; import { formatMemorySize } from '@/lib/utils/memory-limits'; interface MemoryWarningDialogProps { open: boolean; estimatedMemoryMB: number; availableMemoryMB?: number; warning: string; fileName?: string; onContinue: () => void; onCancel: () => void; } export function MemoryWarningDialog({ open, estimatedMemoryMB, availableMemoryMB, warning, fileName, onContinue, onCancel, }: MemoryWarningDialogProps) { if (!open) return null; const estimatedBytes = estimatedMemoryMB * 1024 * 1024; const availableBytes = availableMemoryMB ? availableMemoryMB * 1024 * 1024 : undefined; return (
{/* Header */}

Memory Warning

{warning}

{/* File Info */} {fileName && (
File: {fileName}
)} {/* Memory Details */}
Estimated Memory: {formatMemorySize(estimatedBytes)}
{availableBytes && (
Available Memory: {formatMemorySize(availableBytes)}
)}
{/* Warning Message */}

Note: Loading large files may cause performance issues or browser crashes, especially on devices with limited memory. Consider:

  • Closing other browser tabs
  • Using a shorter audio file
  • Splitting large files into smaller segments
{/* Actions */}
); }