2025-11-17 10:44:49 +01:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
import { ArrowRight } from 'lucide-react';
|
|
|
|
|
import { Button } from '@/components/ui/Button';
|
|
|
|
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/Card';
|
|
|
|
|
import { FileUpload } from './FileUpload';
|
|
|
|
|
import { FormatSelector } from './FormatSelector';
|
|
|
|
|
import { ConversionPreview } from './ConversionPreview';
|
feat: add comprehensive conversion options and enhanced UI
This major update adds powerful format-specific controls, quality presets,
file metadata display, and enhanced progress feedback to significantly
improve the user experience.
New Components:
- ConversionOptionsPanel: Format-specific controls with collapsible advanced options
- Video options: codec selection (H.264, H.265, VP8, VP9), bitrate, resolution, FPS
- Audio options: codec selection, bitrate, sample rate, channels
- Image options: quality slider, width/height controls
- Quality Presets: One-click presets (High Quality, Balanced, Small File, Web Optimized)
- FileInfo: Displays file metadata including size, duration, dimensions
- Slider: Reusable slider component for quality/bitrate controls
- Select: Reusable dropdown component for codec/format selection
Enhanced Features:
- ConversionPreview improvements:
- Real-time elapsed time display
- Estimated time remaining calculation
- File size comparison (input vs output with % reduction/increase)
- Better visual status indicators with icons
- Enhanced loading states with detailed progress
- FileConverter integration:
- Passes conversion options to converter services
- Manages conversion options state
- Resets options on file reset
UI/UX Improvements:
- Format-specific option panels that adapt to selected output format
- Visual preset buttons with icons and descriptions
- Collapsible advanced options to reduce clutter
- Better progress feedback with time estimates
- File size comparison badges showing compression results
- Smooth animations and transitions (existing animations already in place)
- Responsive design for all new components
Technical Details:
- Options are properly typed and integrated with ConversionOptions interface
- All components support disabled states during conversion
- Preview component calculates speed and estimates remaining time
- Metadata extraction for video/audio/image files using browser APIs
- Proper cleanup of object URLs and timers
User Benefits:
- Power users can fine-tune codec, bitrate, resolution settings
- Beginners can use quality presets with confidence
- Better understanding of conversion progress and file size impact
- Informed decisions with file metadata display
- Professional-grade control over output quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:46:10 +01:00
|
|
|
import { ConversionOptionsPanel } from './ConversionOptions';
|
|
|
|
|
import { FileInfo } from './FileInfo';
|
2025-11-17 10:44:49 +01:00
|
|
|
import { useToast } from '@/components/ui/Toast';
|
|
|
|
|
import {
|
|
|
|
|
SUPPORTED_FORMATS,
|
|
|
|
|
getFormatByExtension,
|
|
|
|
|
getFormatByMimeType,
|
|
|
|
|
getCompatibleFormats,
|
|
|
|
|
} from '@/lib/utils/formatMappings';
|
|
|
|
|
import { convertWithFFmpeg } from '@/lib/converters/ffmpegService';
|
|
|
|
|
import { convertWithImageMagick } from '@/lib/converters/imagemagickService';
|
|
|
|
|
import { addToHistory } from '@/lib/storage/history';
|
feat: add comprehensive conversion options and enhanced UI
This major update adds powerful format-specific controls, quality presets,
file metadata display, and enhanced progress feedback to significantly
improve the user experience.
New Components:
- ConversionOptionsPanel: Format-specific controls with collapsible advanced options
- Video options: codec selection (H.264, H.265, VP8, VP9), bitrate, resolution, FPS
- Audio options: codec selection, bitrate, sample rate, channels
- Image options: quality slider, width/height controls
- Quality Presets: One-click presets (High Quality, Balanced, Small File, Web Optimized)
- FileInfo: Displays file metadata including size, duration, dimensions
- Slider: Reusable slider component for quality/bitrate controls
- Select: Reusable dropdown component for codec/format selection
Enhanced Features:
- ConversionPreview improvements:
- Real-time elapsed time display
- Estimated time remaining calculation
- File size comparison (input vs output with % reduction/increase)
- Better visual status indicators with icons
- Enhanced loading states with detailed progress
- FileConverter integration:
- Passes conversion options to converter services
- Manages conversion options state
- Resets options on file reset
UI/UX Improvements:
- Format-specific option panels that adapt to selected output format
- Visual preset buttons with icons and descriptions
- Collapsible advanced options to reduce clutter
- Better progress feedback with time estimates
- File size comparison badges showing compression results
- Smooth animations and transitions (existing animations already in place)
- Responsive design for all new components
Technical Details:
- Options are properly typed and integrated with ConversionOptions interface
- All components support disabled states during conversion
- Preview component calculates speed and estimates remaining time
- Metadata extraction for video/audio/image files using browser APIs
- Proper cleanup of object URLs and timers
User Benefits:
- Power users can fine-tune codec, bitrate, resolution settings
- Beginners can use quality presets with confidence
- Better understanding of conversion progress and file size impact
- Informed decisions with file metadata display
- Professional-grade control over output quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:46:10 +01:00
|
|
|
import type { ConversionJob, ConversionFormat, ConversionOptions } from '@/types/conversion';
|
2025-11-17 10:44:49 +01:00
|
|
|
|
|
|
|
|
export function FileConverter() {
|
|
|
|
|
const { addToast } = useToast();
|
|
|
|
|
|
|
|
|
|
const [selectedFile, setSelectedFile] = React.useState<File | undefined>();
|
|
|
|
|
const [inputFormat, setInputFormat] = React.useState<ConversionFormat | undefined>();
|
|
|
|
|
const [outputFormat, setOutputFormat] = React.useState<ConversionFormat | undefined>();
|
|
|
|
|
const [compatibleFormats, setCompatibleFormats] = React.useState<ConversionFormat[]>([]);
|
|
|
|
|
const [conversionJob, setConversionJob] = React.useState<ConversionJob | undefined>();
|
feat: add comprehensive conversion options and enhanced UI
This major update adds powerful format-specific controls, quality presets,
file metadata display, and enhanced progress feedback to significantly
improve the user experience.
New Components:
- ConversionOptionsPanel: Format-specific controls with collapsible advanced options
- Video options: codec selection (H.264, H.265, VP8, VP9), bitrate, resolution, FPS
- Audio options: codec selection, bitrate, sample rate, channels
- Image options: quality slider, width/height controls
- Quality Presets: One-click presets (High Quality, Balanced, Small File, Web Optimized)
- FileInfo: Displays file metadata including size, duration, dimensions
- Slider: Reusable slider component for quality/bitrate controls
- Select: Reusable dropdown component for codec/format selection
Enhanced Features:
- ConversionPreview improvements:
- Real-time elapsed time display
- Estimated time remaining calculation
- File size comparison (input vs output with % reduction/increase)
- Better visual status indicators with icons
- Enhanced loading states with detailed progress
- FileConverter integration:
- Passes conversion options to converter services
- Manages conversion options state
- Resets options on file reset
UI/UX Improvements:
- Format-specific option panels that adapt to selected output format
- Visual preset buttons with icons and descriptions
- Collapsible advanced options to reduce clutter
- Better progress feedback with time estimates
- File size comparison badges showing compression results
- Smooth animations and transitions (existing animations already in place)
- Responsive design for all new components
Technical Details:
- Options are properly typed and integrated with ConversionOptions interface
- All components support disabled states during conversion
- Preview component calculates speed and estimates remaining time
- Metadata extraction for video/audio/image files using browser APIs
- Proper cleanup of object URLs and timers
User Benefits:
- Power users can fine-tune codec, bitrate, resolution settings
- Beginners can use quality presets with confidence
- Better understanding of conversion progress and file size impact
- Informed decisions with file metadata display
- Professional-grade control over output quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:46:10 +01:00
|
|
|
const [conversionOptions, setConversionOptions] = React.useState<ConversionOptions>({});
|
2025-11-17 10:44:49 +01:00
|
|
|
|
|
|
|
|
// Detect input format when file is selected
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (!selectedFile) {
|
|
|
|
|
setInputFormat(undefined);
|
|
|
|
|
setOutputFormat(undefined);
|
|
|
|
|
setCompatibleFormats([]);
|
|
|
|
|
setConversionJob(undefined);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Try to detect format from extension
|
|
|
|
|
const ext = selectedFile.name.split('.').pop()?.toLowerCase();
|
|
|
|
|
let format = ext ? getFormatByExtension(ext) : undefined;
|
|
|
|
|
|
|
|
|
|
// Fallback to MIME type
|
|
|
|
|
if (!format) {
|
|
|
|
|
format = getFormatByMimeType(selectedFile.type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (format) {
|
|
|
|
|
setInputFormat(format);
|
|
|
|
|
const compatible = getCompatibleFormats(format);
|
|
|
|
|
setCompatibleFormats(compatible);
|
|
|
|
|
|
|
|
|
|
// Auto-select first compatible format
|
|
|
|
|
if (compatible.length > 0 && !outputFormat) {
|
|
|
|
|
setOutputFormat(compatible[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addToast(`Detected format: ${format.name}`, 'success');
|
|
|
|
|
} else {
|
|
|
|
|
addToast('Could not detect file format', 'error');
|
|
|
|
|
setInputFormat(undefined);
|
|
|
|
|
setCompatibleFormats([]);
|
|
|
|
|
}
|
|
|
|
|
}, [selectedFile]);
|
|
|
|
|
|
|
|
|
|
const handleConvert = async () => {
|
|
|
|
|
if (!selectedFile || !inputFormat || !outputFormat) {
|
|
|
|
|
addToast('Please select a file and output format', 'error');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create conversion job
|
|
|
|
|
const job: ConversionJob = {
|
|
|
|
|
id: Math.random().toString(36).substring(7),
|
|
|
|
|
inputFile: selectedFile,
|
|
|
|
|
inputFormat,
|
|
|
|
|
outputFormat,
|
feat: add comprehensive conversion options and enhanced UI
This major update adds powerful format-specific controls, quality presets,
file metadata display, and enhanced progress feedback to significantly
improve the user experience.
New Components:
- ConversionOptionsPanel: Format-specific controls with collapsible advanced options
- Video options: codec selection (H.264, H.265, VP8, VP9), bitrate, resolution, FPS
- Audio options: codec selection, bitrate, sample rate, channels
- Image options: quality slider, width/height controls
- Quality Presets: One-click presets (High Quality, Balanced, Small File, Web Optimized)
- FileInfo: Displays file metadata including size, duration, dimensions
- Slider: Reusable slider component for quality/bitrate controls
- Select: Reusable dropdown component for codec/format selection
Enhanced Features:
- ConversionPreview improvements:
- Real-time elapsed time display
- Estimated time remaining calculation
- File size comparison (input vs output with % reduction/increase)
- Better visual status indicators with icons
- Enhanced loading states with detailed progress
- FileConverter integration:
- Passes conversion options to converter services
- Manages conversion options state
- Resets options on file reset
UI/UX Improvements:
- Format-specific option panels that adapt to selected output format
- Visual preset buttons with icons and descriptions
- Collapsible advanced options to reduce clutter
- Better progress feedback with time estimates
- File size comparison badges showing compression results
- Smooth animations and transitions (existing animations already in place)
- Responsive design for all new components
Technical Details:
- Options are properly typed and integrated with ConversionOptions interface
- All components support disabled states during conversion
- Preview component calculates speed and estimates remaining time
- Metadata extraction for video/audio/image files using browser APIs
- Proper cleanup of object URLs and timers
User Benefits:
- Power users can fine-tune codec, bitrate, resolution settings
- Beginners can use quality presets with confidence
- Better understanding of conversion progress and file size impact
- Informed decisions with file metadata display
- Professional-grade control over output quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:46:10 +01:00
|
|
|
options: conversionOptions,
|
2025-11-17 10:44:49 +01:00
|
|
|
status: 'loading',
|
|
|
|
|
progress: 0,
|
|
|
|
|
startTime: Date.now(),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
setConversionJob(job);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// Update status to processing
|
|
|
|
|
setConversionJob((prev) => prev && { ...prev, status: 'processing', progress: 10 });
|
|
|
|
|
|
|
|
|
|
// Call appropriate converter
|
|
|
|
|
let result;
|
|
|
|
|
|
|
|
|
|
switch (outputFormat.converter) {
|
|
|
|
|
case 'ffmpeg':
|
feat: add comprehensive conversion options and enhanced UI
This major update adds powerful format-specific controls, quality presets,
file metadata display, and enhanced progress feedback to significantly
improve the user experience.
New Components:
- ConversionOptionsPanel: Format-specific controls with collapsible advanced options
- Video options: codec selection (H.264, H.265, VP8, VP9), bitrate, resolution, FPS
- Audio options: codec selection, bitrate, sample rate, channels
- Image options: quality slider, width/height controls
- Quality Presets: One-click presets (High Quality, Balanced, Small File, Web Optimized)
- FileInfo: Displays file metadata including size, duration, dimensions
- Slider: Reusable slider component for quality/bitrate controls
- Select: Reusable dropdown component for codec/format selection
Enhanced Features:
- ConversionPreview improvements:
- Real-time elapsed time display
- Estimated time remaining calculation
- File size comparison (input vs output with % reduction/increase)
- Better visual status indicators with icons
- Enhanced loading states with detailed progress
- FileConverter integration:
- Passes conversion options to converter services
- Manages conversion options state
- Resets options on file reset
UI/UX Improvements:
- Format-specific option panels that adapt to selected output format
- Visual preset buttons with icons and descriptions
- Collapsible advanced options to reduce clutter
- Better progress feedback with time estimates
- File size comparison badges showing compression results
- Smooth animations and transitions (existing animations already in place)
- Responsive design for all new components
Technical Details:
- Options are properly typed and integrated with ConversionOptions interface
- All components support disabled states during conversion
- Preview component calculates speed and estimates remaining time
- Metadata extraction for video/audio/image files using browser APIs
- Proper cleanup of object URLs and timers
User Benefits:
- Power users can fine-tune codec, bitrate, resolution settings
- Beginners can use quality presets with confidence
- Better understanding of conversion progress and file size impact
- Informed decisions with file metadata display
- Professional-grade control over output quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:46:10 +01:00
|
|
|
result = await convertWithFFmpeg(selectedFile, outputFormat.extension, conversionOptions, (progress) => {
|
2025-11-17 10:44:49 +01:00
|
|
|
setConversionJob((prev) => prev && { ...prev, progress });
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'imagemagick':
|
|
|
|
|
result = await convertWithImageMagick(
|
|
|
|
|
selectedFile,
|
|
|
|
|
outputFormat.extension,
|
feat: add comprehensive conversion options and enhanced UI
This major update adds powerful format-specific controls, quality presets,
file metadata display, and enhanced progress feedback to significantly
improve the user experience.
New Components:
- ConversionOptionsPanel: Format-specific controls with collapsible advanced options
- Video options: codec selection (H.264, H.265, VP8, VP9), bitrate, resolution, FPS
- Audio options: codec selection, bitrate, sample rate, channels
- Image options: quality slider, width/height controls
- Quality Presets: One-click presets (High Quality, Balanced, Small File, Web Optimized)
- FileInfo: Displays file metadata including size, duration, dimensions
- Slider: Reusable slider component for quality/bitrate controls
- Select: Reusable dropdown component for codec/format selection
Enhanced Features:
- ConversionPreview improvements:
- Real-time elapsed time display
- Estimated time remaining calculation
- File size comparison (input vs output with % reduction/increase)
- Better visual status indicators with icons
- Enhanced loading states with detailed progress
- FileConverter integration:
- Passes conversion options to converter services
- Manages conversion options state
- Resets options on file reset
UI/UX Improvements:
- Format-specific option panels that adapt to selected output format
- Visual preset buttons with icons and descriptions
- Collapsible advanced options to reduce clutter
- Better progress feedback with time estimates
- File size comparison badges showing compression results
- Smooth animations and transitions (existing animations already in place)
- Responsive design for all new components
Technical Details:
- Options are properly typed and integrated with ConversionOptions interface
- All components support disabled states during conversion
- Preview component calculates speed and estimates remaining time
- Metadata extraction for video/audio/image files using browser APIs
- Proper cleanup of object URLs and timers
User Benefits:
- Power users can fine-tune codec, bitrate, resolution settings
- Beginners can use quality presets with confidence
- Better understanding of conversion progress and file size impact
- Informed decisions with file metadata display
- Professional-grade control over output quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:46:10 +01:00
|
|
|
conversionOptions,
|
2025-11-17 10:44:49 +01:00
|
|
|
(progress) => {
|
|
|
|
|
setConversionJob((prev) => prev && { ...prev, progress });
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
throw new Error(`Unknown converter: ${outputFormat.converter}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update job with result
|
|
|
|
|
if (result.success && result.blob) {
|
|
|
|
|
setConversionJob((prev) => prev && {
|
|
|
|
|
...prev,
|
|
|
|
|
status: 'completed',
|
|
|
|
|
progress: 100,
|
|
|
|
|
result: result.blob,
|
|
|
|
|
endTime: Date.now(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
addToast('Conversion completed successfully!', 'success');
|
|
|
|
|
|
|
|
|
|
// Add to history
|
|
|
|
|
addToHistory({
|
|
|
|
|
inputFileName: selectedFile.name,
|
|
|
|
|
inputFormat: inputFormat.name,
|
|
|
|
|
outputFormat: outputFormat.name,
|
|
|
|
|
outputFileName: `output.${outputFormat.extension}`,
|
|
|
|
|
fileSize: result.blob.size,
|
|
|
|
|
result: result.blob,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
setConversionJob((prev) => prev && {
|
|
|
|
|
...prev,
|
|
|
|
|
status: 'error',
|
|
|
|
|
error: result.error || 'Unknown error',
|
|
|
|
|
endTime: Date.now(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
addToast(result.error || 'Conversion failed', 'error');
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
|
|
|
|
|
|
|
|
setConversionJob((prev) => prev && {
|
|
|
|
|
...prev,
|
|
|
|
|
status: 'error',
|
|
|
|
|
error: errorMessage,
|
|
|
|
|
endTime: Date.now(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
addToast(`Conversion failed: ${errorMessage}`, 'error');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleReset = () => {
|
|
|
|
|
setSelectedFile(undefined);
|
|
|
|
|
setInputFormat(undefined);
|
|
|
|
|
setOutputFormat(undefined);
|
|
|
|
|
setCompatibleFormats([]);
|
|
|
|
|
setConversionJob(undefined);
|
feat: add comprehensive conversion options and enhanced UI
This major update adds powerful format-specific controls, quality presets,
file metadata display, and enhanced progress feedback to significantly
improve the user experience.
New Components:
- ConversionOptionsPanel: Format-specific controls with collapsible advanced options
- Video options: codec selection (H.264, H.265, VP8, VP9), bitrate, resolution, FPS
- Audio options: codec selection, bitrate, sample rate, channels
- Image options: quality slider, width/height controls
- Quality Presets: One-click presets (High Quality, Balanced, Small File, Web Optimized)
- FileInfo: Displays file metadata including size, duration, dimensions
- Slider: Reusable slider component for quality/bitrate controls
- Select: Reusable dropdown component for codec/format selection
Enhanced Features:
- ConversionPreview improvements:
- Real-time elapsed time display
- Estimated time remaining calculation
- File size comparison (input vs output with % reduction/increase)
- Better visual status indicators with icons
- Enhanced loading states with detailed progress
- FileConverter integration:
- Passes conversion options to converter services
- Manages conversion options state
- Resets options on file reset
UI/UX Improvements:
- Format-specific option panels that adapt to selected output format
- Visual preset buttons with icons and descriptions
- Collapsible advanced options to reduce clutter
- Better progress feedback with time estimates
- File size comparison badges showing compression results
- Smooth animations and transitions (existing animations already in place)
- Responsive design for all new components
Technical Details:
- Options are properly typed and integrated with ConversionOptions interface
- All components support disabled states during conversion
- Preview component calculates speed and estimates remaining time
- Metadata extraction for video/audio/image files using browser APIs
- Proper cleanup of object URLs and timers
User Benefits:
- Power users can fine-tune codec, bitrate, resolution settings
- Beginners can use quality presets with confidence
- Better understanding of conversion progress and file size impact
- Informed decisions with file metadata display
- Professional-grade control over output quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:46:10 +01:00
|
|
|
setConversionOptions({});
|
2025-11-17 10:44:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const isConvertDisabled =
|
|
|
|
|
!selectedFile || !outputFormat || conversionJob?.status === 'loading' || conversionJob?.status === 'processing';
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="w-full max-w-4xl mx-auto space-y-6">
|
|
|
|
|
{/* Header */}
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<CardTitle>File Converter</CardTitle>
|
|
|
|
|
<CardDescription>
|
refactor: remove all document conversion support, keep only media conversions
This commit completely removes document conversion functionality to focus
exclusively on media file conversions (video, audio, images).
Changes:
- Remove all document converter services (pandocService.ts, pdfService.ts, docxService.ts)
- Uninstall document-related packages: marked, turndown, dompurify, jspdf, pdfjs-dist, docx, mammoth, @types/turndown
- Remove document formats (PDF, DOCX, Markdown, HTML, TXT) from formatMappings.ts
- Remove pandoc converter from FileConverter.tsx
- Remove pandoc loader and references from wasmLoader.ts
- Update TypeScript types to remove 'pandoc' from ConverterEngine and 'document' from FileCategory
- Remove pandoc from WASMModuleState interface
- Update README.md to remove all document conversion documentation
- Update UI descriptions to reflect media-only conversions
Supported conversions now:
- Video: MP4, WebM, AVI, MOV, MKV, GIF
- Audio: MP3, WAV, OGG, AAC, FLAC
- Images: PNG, JPG, WebP, GIF, BMP, TIFF, SVG
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:35:20 +01:00
|
|
|
Convert videos, audio, and images directly in your browser using WebAssembly
|
2025-11-17 10:44:49 +01:00
|
|
|
</CardDescription>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent className="space-y-6">
|
|
|
|
|
{/* File upload */}
|
|
|
|
|
<FileUpload
|
|
|
|
|
onFileSelect={setSelectedFile}
|
|
|
|
|
onFileRemove={handleReset}
|
|
|
|
|
selectedFile={selectedFile}
|
|
|
|
|
disabled={conversionJob?.status === 'processing' || conversionJob?.status === 'loading'}
|
|
|
|
|
/>
|
|
|
|
|
|
feat: add comprehensive conversion options and enhanced UI
This major update adds powerful format-specific controls, quality presets,
file metadata display, and enhanced progress feedback to significantly
improve the user experience.
New Components:
- ConversionOptionsPanel: Format-specific controls with collapsible advanced options
- Video options: codec selection (H.264, H.265, VP8, VP9), bitrate, resolution, FPS
- Audio options: codec selection, bitrate, sample rate, channels
- Image options: quality slider, width/height controls
- Quality Presets: One-click presets (High Quality, Balanced, Small File, Web Optimized)
- FileInfo: Displays file metadata including size, duration, dimensions
- Slider: Reusable slider component for quality/bitrate controls
- Select: Reusable dropdown component for codec/format selection
Enhanced Features:
- ConversionPreview improvements:
- Real-time elapsed time display
- Estimated time remaining calculation
- File size comparison (input vs output with % reduction/increase)
- Better visual status indicators with icons
- Enhanced loading states with detailed progress
- FileConverter integration:
- Passes conversion options to converter services
- Manages conversion options state
- Resets options on file reset
UI/UX Improvements:
- Format-specific option panels that adapt to selected output format
- Visual preset buttons with icons and descriptions
- Collapsible advanced options to reduce clutter
- Better progress feedback with time estimates
- File size comparison badges showing compression results
- Smooth animations and transitions (existing animations already in place)
- Responsive design for all new components
Technical Details:
- Options are properly typed and integrated with ConversionOptions interface
- All components support disabled states during conversion
- Preview component calculates speed and estimates remaining time
- Metadata extraction for video/audio/image files using browser APIs
- Proper cleanup of object URLs and timers
User Benefits:
- Power users can fine-tune codec, bitrate, resolution settings
- Beginners can use quality presets with confidence
- Better understanding of conversion progress and file size impact
- Informed decisions with file metadata display
- Professional-grade control over output quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:46:10 +01:00
|
|
|
{/* File Info */}
|
|
|
|
|
{selectedFile && inputFormat && (
|
|
|
|
|
<FileInfo file={selectedFile} format={inputFormat} />
|
|
|
|
|
)}
|
|
|
|
|
|
2025-11-17 10:44:49 +01:00
|
|
|
{/* Format selection */}
|
|
|
|
|
{inputFormat && compatibleFormats.length > 0 && (
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-[1fr_auto_1fr] gap-4 items-start">
|
|
|
|
|
{/* Input format */}
|
|
|
|
|
<div>
|
|
|
|
|
<label className="text-sm font-medium text-foreground mb-2 block">Input Format</label>
|
|
|
|
|
<Card className="p-4">
|
|
|
|
|
<p className="font-medium">{inputFormat.name}</p>
|
|
|
|
|
<p className="text-xs text-muted-foreground mt-1">{inputFormat.description}</p>
|
|
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Arrow */}
|
|
|
|
|
<div className="hidden md:flex items-center justify-center pt-8">
|
|
|
|
|
<ArrowRight className="h-5 w-5 text-muted-foreground" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Output format */}
|
|
|
|
|
<FormatSelector
|
|
|
|
|
formats={compatibleFormats}
|
|
|
|
|
selectedFormat={outputFormat}
|
|
|
|
|
onFormatSelect={setOutputFormat}
|
|
|
|
|
label="Output Format"
|
|
|
|
|
disabled={conversionJob?.status === 'processing' || conversionJob?.status === 'loading'}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
feat: add comprehensive conversion options and enhanced UI
This major update adds powerful format-specific controls, quality presets,
file metadata display, and enhanced progress feedback to significantly
improve the user experience.
New Components:
- ConversionOptionsPanel: Format-specific controls with collapsible advanced options
- Video options: codec selection (H.264, H.265, VP8, VP9), bitrate, resolution, FPS
- Audio options: codec selection, bitrate, sample rate, channels
- Image options: quality slider, width/height controls
- Quality Presets: One-click presets (High Quality, Balanced, Small File, Web Optimized)
- FileInfo: Displays file metadata including size, duration, dimensions
- Slider: Reusable slider component for quality/bitrate controls
- Select: Reusable dropdown component for codec/format selection
Enhanced Features:
- ConversionPreview improvements:
- Real-time elapsed time display
- Estimated time remaining calculation
- File size comparison (input vs output with % reduction/increase)
- Better visual status indicators with icons
- Enhanced loading states with detailed progress
- FileConverter integration:
- Passes conversion options to converter services
- Manages conversion options state
- Resets options on file reset
UI/UX Improvements:
- Format-specific option panels that adapt to selected output format
- Visual preset buttons with icons and descriptions
- Collapsible advanced options to reduce clutter
- Better progress feedback with time estimates
- File size comparison badges showing compression results
- Smooth animations and transitions (existing animations already in place)
- Responsive design for all new components
Technical Details:
- Options are properly typed and integrated with ConversionOptions interface
- All components support disabled states during conversion
- Preview component calculates speed and estimates remaining time
- Metadata extraction for video/audio/image files using browser APIs
- Proper cleanup of object URLs and timers
User Benefits:
- Power users can fine-tune codec, bitrate, resolution settings
- Beginners can use quality presets with confidence
- Better understanding of conversion progress and file size impact
- Informed decisions with file metadata display
- Professional-grade control over output quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:46:10 +01:00
|
|
|
{/* Conversion Options */}
|
|
|
|
|
{inputFormat && outputFormat && (
|
|
|
|
|
<ConversionOptionsPanel
|
|
|
|
|
inputFormat={inputFormat}
|
|
|
|
|
outputFormat={outputFormat}
|
|
|
|
|
options={conversionOptions}
|
|
|
|
|
onOptionsChange={setConversionOptions}
|
|
|
|
|
disabled={conversionJob?.status === 'processing' || conversionJob?.status === 'loading'}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
2025-11-17 10:44:49 +01:00
|
|
|
{/* Convert button */}
|
|
|
|
|
{inputFormat && outputFormat && (
|
|
|
|
|
<div className="flex gap-3">
|
|
|
|
|
<Button
|
|
|
|
|
onClick={handleConvert}
|
|
|
|
|
disabled={isConvertDisabled}
|
|
|
|
|
className="flex-1"
|
|
|
|
|
size="lg"
|
|
|
|
|
>
|
|
|
|
|
{conversionJob?.status === 'loading' || conversionJob?.status === 'processing'
|
|
|
|
|
? 'Converting...'
|
|
|
|
|
: 'Convert'}
|
|
|
|
|
</Button>
|
|
|
|
|
<Button onClick={handleReset} variant="outline" size="lg">
|
|
|
|
|
Reset
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
{/* Conversion preview */}
|
|
|
|
|
{conversionJob && <ConversionPreview job={conversionJob} />}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|