From cdae10ca0aeaf23d49591cb81fe9dac7b83ff642 Mon Sep 17 00:00:00 2001 From: Anwarul Islam Date: Fri, 18 Jul 2025 07:38:32 +0600 Subject: feat: refactor keybinding management and add keybinding editor component --- .../web/src/components/keyboard-shortcuts-help.tsx | 36 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 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 c908b9ce..c40e5eb4 100644 --- a/apps/web/src/components/keyboard-shortcuts-help.tsx +++ b/apps/web/src/components/keyboard-shortcuts-help.tsx @@ -11,11 +11,12 @@ import { DialogTrigger, } from "./ui/dialog"; import { Badge } from "./ui/badge"; -import { Keyboard } from "lucide-react"; +import { Keyboard, Settings } from "lucide-react"; import { useKeyboardShortcutsHelp, KeyboardShortcut, } from "@/hooks/use-keyboard-shortcuts-help"; +import { KeybindingEditor } from "./keybinding-editor"; const KeyBadge = ({ keyName }: { keyName: string }) => { // Replace common key names with symbols or friendly names @@ -88,12 +89,32 @@ const ShortcutItem = ({ shortcut }: { shortcut: KeyboardShortcut }) => { export const KeyboardShortcutsHelp = () => { const [open, setOpen] = useState(false); + const [showEditor, setShowEditor] = useState(false); // Get shortcuts from centralized hook const { shortcuts } = useKeyboardShortcutsHelp(); const categories = Array.from(new Set(shortcuts.map((s) => s.category))); + if (showEditor) { + return ( + + + + + + setShowEditor(false)} + /> + + + ); + } + return ( @@ -102,7 +123,7 @@ export const KeyboardShortcutsHelp = () => { Shortcuts - + @@ -114,6 +135,17 @@ export const KeyboardShortcutsHelp = () => { +
+ +
+
{categories.map((category) => (
-- cgit v1.3.1