Added comprehensive mobile support for Phase 15 (Polish & Optimization): **Mobile Layout Enhancements:** - Track controls now collapsible on mobile with two states: - Collapsed: minimal controls with expand chevron, R/M/S buttons, horizontal level meter - Expanded: full height fader, pan control, all buttons - Track collapse buttons added to mobile view (left chevron for track collapse, right chevron for control collapse) - Master controls collapse button hidden on desktop (lg:hidden) - Automation and effects bars now available on mobile layout - Both bars collapsible with eye/eye-off icons, horizontally scrollable when zoomed - Mobile vertical stacking: controls → waveform → automation → effects per track **Bug Fixes:** - Fixed track controls and waveform container height matching on desktop - Fixed Modal component prop: isOpen → open in all dialog components - Fixed TypeScript null check for audioBuffer.duration - Fixed keyboard shortcut category: 'help' → 'view' **Technical Improvements:** - Consistent height calculation using trackHeight variable - Proper responsive breakpoints with Tailwind (sm:640px, lg:1024px) - Progressive disclosure pattern for mobile controls 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
102 lines
3.5 KiB
TypeScript
102 lines
3.5 KiB
TypeScript
'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 (
|
|
<Modal open={open} onClose={onCancel} title="">
|
|
<div className="p-6 max-w-md">
|
|
{/* Header */}
|
|
<div className="flex items-start justify-between mb-4">
|
|
<div className="flex items-center gap-2">
|
|
<AlertTriangle className="h-5 w-5 text-yellow-500" />
|
|
<h2 className="text-lg font-semibold">Memory Warning</h2>
|
|
</div>
|
|
<button onClick={onCancel} className="text-muted-foreground hover:text-foreground">
|
|
<X className="h-4 w-4" />
|
|
</button>
|
|
</div>
|
|
|
|
<p className="text-sm text-muted-foreground mb-4">
|
|
{warning}
|
|
</p>
|
|
|
|
<div className="space-y-4">
|
|
{/* File Info */}
|
|
{fileName && (
|
|
<div className="flex items-center gap-2 text-sm">
|
|
<Info className="h-4 w-4 text-muted-foreground" />
|
|
<span className="font-medium">File:</span>
|
|
<span className="text-muted-foreground truncate">{fileName}</span>
|
|
</div>
|
|
)}
|
|
|
|
{/* Memory Details */}
|
|
<div className="bg-muted/50 border border-border rounded-md p-3 space-y-2">
|
|
<div className="flex justify-between text-sm">
|
|
<span className="text-muted-foreground">Estimated Memory:</span>
|
|
<span className="font-medium">{formatMemorySize(estimatedBytes)}</span>
|
|
</div>
|
|
{availableBytes && (
|
|
<div className="flex justify-between text-sm">
|
|
<span className="text-muted-foreground">Available Memory:</span>
|
|
<span className="font-medium">{formatMemorySize(availableBytes)}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Warning Message */}
|
|
<div className="bg-yellow-500/10 border border-yellow-500/20 rounded-md p-3">
|
|
<p className="text-sm text-yellow-700 dark:text-yellow-400">
|
|
<strong>Note:</strong> Loading large files may cause performance issues or browser crashes,
|
|
especially on devices with limited memory. Consider:
|
|
</p>
|
|
<ul className="mt-2 text-sm text-yellow-700 dark:text-yellow-400 space-y-1 list-disc list-inside">
|
|
<li>Closing other browser tabs</li>
|
|
<li>Using a shorter audio file</li>
|
|
<li>Splitting large files into smaller segments</li>
|
|
</ul>
|
|
</div>
|
|
|
|
{/* Actions */}
|
|
<div className="flex justify-end gap-2">
|
|
<Button onClick={onCancel} variant="outline">
|
|
Cancel
|
|
</Button>
|
|
<Button onClick={onContinue} variant="default">
|
|
Continue Anyway
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Modal>
|
|
);
|
|
}
|