summaryrefslogtreecommitdiff
path: root/apps/web/src/hooks/use-keyboard-shortcuts-help.ts
diff options
context:
space:
mode:
authorAnwarul Islam <anwaarulislaam@gmail.com>2025-07-18 07:38:32 +0600
committerAnwarul Islam <anwaarulislaam@gmail.com>2025-07-18 07:38:32 +0600
commitcdae10ca0aeaf23d49591cb81fe9dac7b83ff642 (patch)
tree5d57208b23dc2513dddee24bd479e3f9ca662439 /apps/web/src/hooks/use-keyboard-shortcuts-help.ts
parent33531fb3bf2628d5c5c79d43e0e37b543c9384e1 (diff)
downloadopencut-cdae10ca0aeaf23d49591cb81fe9dac7b83ff642.tar.gz
feat: refactor keybinding management and add keybinding editor component
Diffstat (limited to 'apps/web/src/hooks/use-keyboard-shortcuts-help.ts')
-rw-r--r--apps/web/src/hooks/use-keyboard-shortcuts-help.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/web/src/hooks/use-keyboard-shortcuts-help.ts b/apps/web/src/hooks/use-keyboard-shortcuts-help.ts
index cac68524..bd8beffc 100644
--- a/apps/web/src/hooks/use-keyboard-shortcuts-help.ts
+++ b/apps/web/src/hooks/use-keyboard-shortcuts-help.ts
@@ -1,7 +1,7 @@
"use client";
import { useMemo } from "react";
-import { bindings } from "@/constants/keybindings";
+import { useKeybindingsStore } from "@/stores/keybindings-store";
import { Action } from "@/constants/actions";
export interface KeyboardShortcut {
@@ -83,13 +83,15 @@ const formatKey = (key: string): string => {
};
export const useKeyboardShortcutsHelp = () => {
+ const { keybindings } = useKeybindingsStore();
+
const shortcuts = useMemo(() => {
const result: KeyboardShortcut[] = [];
// Group keybindings by action
const actionToKeys: Record<Action, string[]> = {} as any;
- Object.entries(bindings).forEach(([key, action]) => {
+ Object.entries(keybindings).forEach(([key, action]) => {
if (action) {
if (!actionToKeys[action]) {
actionToKeys[action] = [];
@@ -113,7 +115,7 @@ export const useKeyboardShortcutsHelp = () => {
});
return result;
- }, []);
+ }, [keybindings]);
return {
shortcuts,