From 8bc26539ebe44d6ff0d74d86ef316934c7f18faf Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 16 Jul 2025 14:37:08 +0200 Subject: cleanup (this doesn't work) --- .../web/src/components/keyboard-shortcuts-help.tsx | 137 +++------------------ 1 file changed, 15 insertions(+), 122 deletions(-) (limited to 'apps/web/src/components/keyboard-shortcuts-help.tsx') diff --git a/apps/web/src/components/keyboard-shortcuts-help.tsx b/apps/web/src/components/keyboard-shortcuts-help.tsx index 129cb438..9f0d1e57 100644 --- a/apps/web/src/components/keyboard-shortcuts-help.tsx +++ b/apps/web/src/components/keyboard-shortcuts-help.tsx @@ -11,120 +11,8 @@ import { DialogTrigger, } from "./ui/dialog"; import { Badge } from "./ui/badge"; -import { Keyboard, Play, Pause, SkipBack, SkipForward } from "lucide-react"; - -interface Shortcut { - keys: string[]; - description: string; - category: string; - icon?: React.ReactNode; -} - -const shortcuts: Shortcut[] = [ - // Playback Controls - { - keys: ["Space"], - description: "Play/Pause", - category: "Playback", - icon: - }, - { - keys: ["J"], - description: "Rewind 1 second", - category: "Playback", - icon: - }, - { - keys: ["K"], - description: "Play/Pause (alternative)", - category: "Playback", - icon: - }, - { - keys: ["L"], - description: "Fast forward 1 second", - category: "Playback", - icon: - }, - - // Navigation - { - keys: ["←"], - description: "Frame step backward", - category: "Navigation" - }, - { - keys: ["→"], - description: "Frame step forward", - category: "Navigation" - }, - { - keys: ["Shift", "←"], - description: "Jump back 5 seconds", - category: "Navigation" - }, - { - keys: ["Shift", "→"], - description: "Jump forward 5 seconds", - category: "Navigation" - }, - { - keys: ["Home"], - description: "Go to timeline start", - category: "Navigation" - }, - { - keys: ["End"], - description: "Go to timeline end", - category: "Navigation" - }, - - // Editing - { - keys: ["S"], - description: "Split element at playhead", - category: "Editing" - }, - { - keys: ["Delete", "Backspace"], - description: "Delete selected elements", - category: "Editing" - }, - { - keys: ["N"], - description: "Toggle snapping", - category: "Editing" - }, - - // Selection & Organization - { - keys: ["Cmd", "A"], - description: "Select all elements", - category: "Selection" - }, - { - keys: ["Cmd", "D"], - description: "Duplicate selected element", - category: "Selection" - }, - - // History - { - keys: ["Cmd", "Z"], - description: "Undo", - category: "History" - }, - { - keys: ["Cmd", "Shift", "Z"], - description: "Redo", - category: "History" - }, - { - keys: ["Cmd", "Y"], - description: "Redo (alternative)", - category: "History" - } -]; +import { Keyboard } from "lucide-react"; +import { useKeyboardShortcuts } from "@/hooks/use-keyboard-shortcuts"; const KeyBadge = ({ keyName }: { keyName: string }) => { // Replace common key names with symbols @@ -142,7 +30,7 @@ const KeyBadge = ({ keyName }: { keyName: string }) => { ); }; -const ShortcutItem = ({ shortcut }: { shortcut: Shortcut }) => ( +const ShortcutItem = ({ shortcut }: { shortcut: any }) => (
{shortcut.icon && ( @@ -151,7 +39,7 @@ const ShortcutItem = ({ shortcut }: { shortcut: Shortcut }) => ( {shortcut.description}
- {shortcut.keys.map((key, index) => ( + {shortcut.keys.map((key: string, index: number) => (
{index < shortcut.keys.length - 1 && ( @@ -166,7 +54,10 @@ const ShortcutItem = ({ shortcut }: { shortcut: Shortcut }) => ( export const KeyboardShortcutsHelp = () => { const [open, setOpen] = useState(false); - const categories = Array.from(new Set(shortcuts.map(s => s.category))); + // Get shortcuts from centralized hook (disabled so it doesn't add event listeners) + const { shortcuts } = useKeyboardShortcuts({ enabled: false }); + + const categories = Array.from(new Set(shortcuts.map((s) => s.category))); return ( @@ -187,16 +78,16 @@ export const KeyboardShortcutsHelp = () => { Most shortcuts work when the timeline is focused. - +
- {categories.map(category => ( + {categories.map((category) => (

{category}

{shortcuts - .filter(shortcut => shortcut.category === category) + .filter((shortcut) => shortcut.category === category) .map((shortcut, index) => ( ))} @@ -208,7 +99,9 @@ export const KeyboardShortcutsHelp = () => {

Tips:

    -
  • • Shortcuts work when the editor is focused (not typing in inputs)
  • +
  • + • Shortcuts work when the editor is focused (not typing in inputs) +
  • • J/K/L are industry-standard video editing shortcuts
  • • Use arrow keys for frame-perfect positioning
  • • Hold Shift with arrow keys for larger jumps
  • @@ -217,4 +110,4 @@ export const KeyboardShortcutsHelp = () => {
); -}; \ No newline at end of file +}; -- cgit v1.3.1