From 174bbdefaeb9af0b31d3ab9627ce1ee8d76bf019 Mon Sep 17 00:00:00 2001 From: TanviHanda Date: Sun, 17 May 2026 14:50:34 +0530 Subject: [PATCH] Add data-testid attributes to key UI elements --- src/components/AudioSpeedControl.tsx | 91 ++++++++--------- src/components/DownloadResult.tsx | 2 + src/components/ExportOverlay.tsx | 1 + src/components/ExportSettings.tsx | 143 +++++++-------------------- src/components/FileUpload.tsx | 50 +++++++--- src/components/VideoEditor.tsx | 2 +- 6 files changed, 115 insertions(+), 174 deletions(-) diff --git a/src/components/AudioSpeedControl.tsx b/src/components/AudioSpeedControl.tsx index a6c82102..78a622b2 100644 --- a/src/components/AudioSpeedControl.tsx +++ b/src/components/AudioSpeedControl.tsx @@ -1,4 +1,5 @@ "use client"; +import { useEffect } from "react"; import { EditRecipe } from "@/lib/types" import { SPEED_STEPS } from "@/lib/constants"; @@ -11,6 +12,36 @@ interface Props { } export default function AudioSpeedControl({ recipe, onChange }: Props) { + useEffect(() => { + const handler = (e: KeyboardEvent) => { + const target = e.target as HTMLElement; + + if ( + target.tagName === "INPUT" || + target.tagName === "TEXTAREA" || + target.isContentEditable + ) { + return; + } + + if ( + e.key.toLowerCase() === "m" && + !e.ctrlKey && + !e.metaKey + ) { + onChange({ + keepAudio: !recipe.keepAudio, + }); + } + }; + + document.addEventListener("keydown", handler); + + return () => { + document.removeEventListener("keydown", handler); + }; + }, [recipe.keepAudio, onChange]); + const speedIndex = SPEED_STEPS.indexOf(recipe.speed as (typeof SPEED_STEPS)[number]); const getSpeedDescription = (speed: number) => { @@ -29,7 +60,6 @@ export default function AudioSpeedControl({ recipe, onChange }: Props) {
@@ -77,7 +97,7 @@ export default function AudioSpeedControl({ recipe, onChange }: Props) { htmlFor="speed-control" className="text-sm font-heading font-semibold uppercase tracking-wider text-[var(--muted)] flex items-center gap-2" > -
- {recipe.keepAudio && ( - - )} - {recipe.keepAudio && (recipe.trimStart !== 0 || recipe.trimEnd !== null) && ( -
-