feat: remove keyboard shortcuts from media app
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import { ArrowRight, ArrowDown, Keyboard } from 'lucide-react';
|
||||
import { ArrowRight, ArrowDown } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { FileUpload } from './FileUpload';
|
||||
@@ -22,8 +22,6 @@ import { convertWithImageMagick } from '@/lib/media/converters/imagemagickServic
|
||||
import { addToHistory } from '@/lib/media/storage/history';
|
||||
import { downloadBlobsAsZip, generateOutputFilename } from '@/lib/media/utils/fileUtils';
|
||||
import { getPresetById, type FormatPreset } from '@/lib/media/utils/formatPresets';
|
||||
import { useKeyboardShortcuts, type KeyboardShortcut } from '@/lib/media/hooks/useKeyboardShortcuts';
|
||||
import { KeyboardShortcutsModal } from '@/components/ui/KeyboardShortcutsModal';
|
||||
import type { ConversionJob, ConversionFormat, ConversionOptions } from '@/types/media';
|
||||
|
||||
export function FileConverter() {
|
||||
@@ -33,7 +31,6 @@ export function FileConverter() {
|
||||
const [compatibleFormats, setCompatibleFormats] = React.useState<ConversionFormat[]>([]);
|
||||
const [conversionJobs, setConversionJobs] = React.useState<ConversionJob[]>([]);
|
||||
const [conversionOptions, setConversionOptions] = React.useState<ConversionOptions>({});
|
||||
const [showShortcutsModal, setShowShortcutsModal] = React.useState(false);
|
||||
|
||||
const fileInputRef = React.useRef<HTMLInputElement>(null);
|
||||
|
||||
@@ -377,69 +374,6 @@ export function FileConverter() {
|
||||
const isConvertDisabled = selectedFiles.length === 0 || !outputFormat || isConverting;
|
||||
const completedCount = conversionJobs.filter(job => job.status === 'completed').length;
|
||||
|
||||
// Define keyboard shortcuts
|
||||
const shortcuts: KeyboardShortcut[] = [
|
||||
{
|
||||
key: 'o',
|
||||
ctrl: true,
|
||||
description: 'Open file dialog',
|
||||
action: () => {
|
||||
if (!isConverting) {
|
||||
fileInputRef.current?.click();
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'Enter',
|
||||
ctrl: true,
|
||||
description: 'Start conversion',
|
||||
action: () => {
|
||||
if (!isConvertDisabled) {
|
||||
handleConvert();
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 's',
|
||||
ctrl: true,
|
||||
description: 'Download results',
|
||||
action: () => {
|
||||
if (completedCount > 0) {
|
||||
handleDownloadAll();
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'r',
|
||||
ctrl: true,
|
||||
description: 'Reset converter',
|
||||
action: () => {
|
||||
if (!isConverting) {
|
||||
handleReset();
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '/',
|
||||
ctrl: true,
|
||||
description: 'Show keyboard shortcuts',
|
||||
action: () => setShowShortcutsModal(true),
|
||||
},
|
||||
{
|
||||
key: 'Escape',
|
||||
description: 'Close shortcuts modal',
|
||||
action: () => setShowShortcutsModal(false),
|
||||
},
|
||||
{
|
||||
key: '?',
|
||||
description: 'Show keyboard shortcuts',
|
||||
action: () => setShowShortcutsModal(true),
|
||||
},
|
||||
];
|
||||
|
||||
// Enable keyboard shortcuts
|
||||
useKeyboardShortcuts(shortcuts, !showShortcutsModal);
|
||||
|
||||
return (
|
||||
<div className="w-full max-w-4xl mx-auto space-y-6">
|
||||
{/* Header */}
|
||||
@@ -566,22 +500,6 @@ export function FileConverter() {
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Keyboard Shortcuts Button */}
|
||||
<Button
|
||||
onClick={() => setShowShortcutsModal(true)}
|
||||
className="fixed bottom-6 right-6 rounded-full w-12 h-12 p-0 shadow-lg"
|
||||
title="Keyboard Shortcuts (Ctrl+/)"
|
||||
>
|
||||
<Keyboard className="h-5 w-5" />
|
||||
</Button>
|
||||
|
||||
{/* Keyboard Shortcuts Modal */}
|
||||
<KeyboardShortcutsModal
|
||||
shortcuts={shortcuts}
|
||||
isOpen={showShortcutsModal}
|
||||
onClose={() => setShowShortcutsModal(false)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user