From 9593ee516b4000b54f068e6e3c5fbcd33964c1e9 Mon Sep 17 00:00:00 2001 From: "Ibrahima G. Coulibaly" Date: Fri, 23 May 2025 20:18:04 +0100 Subject: [PATCH] fix: misc --- src/components/input/BaseFileInput.tsx | 13 ++----------- src/pages/tools/video/change-speed/index.tsx | 6 +++--- src/pages/tools/video/change-speed/meta.ts | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/components/input/BaseFileInput.tsx b/src/components/input/BaseFileInput.tsx index 6346b6d..ebc3840 100644 --- a/src/components/input/BaseFileInput.tsx +++ b/src/components/input/BaseFileInput.tsx @@ -41,7 +41,7 @@ export default function BaseFileInput({ } catch (error) { console.error('Error previewing file:', error); } - } + } else setPreview(null); }, [value]); const handleFileChange = (event: React.ChangeEvent) => { @@ -67,11 +67,6 @@ export default function BaseFileInput({ } }; - function handleClear() { - // @ts-ignore - onChange(null); - } - const handleDrop = (event: React.DragEvent) => { event.preventDefault(); event.stopPropagation(); @@ -213,11 +208,7 @@ export default function BaseFileInput({ )} - + (null); const [loading, setLoading] = useState(false); - // FFmpeg only supports atempo between 0.5 and 2.0, so we chain filters + // FFmpeg only supports a tempo between 0.5 and 2.0, so we chain filters const computeAudioFilter = (speed: number): string => { if (speed <= 2 && speed >= 0.5) { return `atempo=${speed}`; } // Break into supported chunks - const filters = []; + const filters: string[] = []; let remainingSpeed = speed; while (remainingSpeed > 2.0) { filters.push('atempo=2.0'); @@ -55,6 +54,7 @@ export default function ChangeSpeed({ file: File, newSpeed: number ): Promise => { + if (newSpeed === 0) return; setLoading(true); if (!ffmpeg) { diff --git a/src/pages/tools/video/change-speed/meta.ts b/src/pages/tools/video/change-speed/meta.ts index 37a88d8..ff4f0ad 100644 --- a/src/pages/tools/video/change-speed/meta.ts +++ b/src/pages/tools/video/change-speed/meta.ts @@ -7,7 +7,7 @@ export const tool = defineTool('video', { icon: 'material-symbols-light:speed-outline', description: 'This online utility lets you change the speed of a video. You can speed it up or slow it down.', - shortDescription: 'Quickly change VIDEO speed', + shortDescription: 'Quickly change video speed', keywords: ['change', 'speed'], component: lazy(() => import('./index')) });