summaryrefslogtreecommitdiff
path: root/apps/web/src/stores
diff options
context:
space:
mode:
authorAnwarul Islam <anwaarulislaam@gmail.com>2025-07-18 08:05:02 +0600
committerAnwarul Islam <anwaarulislaam@gmail.com>2025-07-18 08:05:02 +0600
commit8e4661951d214f917357caef9d2895f2a4f7eb1e (patch)
treec596f664763bbc75f6afdf61d0aff70aab905821 /apps/web/src/stores
parentcdae10ca0aeaf23d49591cb81fe9dac7b83ff642 (diff)
downloadopencut-8e4661951d214f917357caef9d2895f2a4f7eb1e.tar.gz
feat: enhance keybinding management by integrating keybindingsEnabled state and updating related hooks
Diffstat (limited to 'apps/web/src/stores')
-rw-r--r--apps/web/src/stores/keybindings-store.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/web/src/stores/keybindings-store.ts b/apps/web/src/stores/keybindings-store.ts
index ddfb270b..6a72423f 100644
--- a/apps/web/src/stores/keybindings-store.ts
+++ b/apps/web/src/stores/keybindings-store.ts
@@ -43,6 +43,7 @@ export interface KeybindingConflict {
interface KeybindingsState {
keybindings: KeybindingConfig;
isCustomized: boolean;
+ keybindingsEnabled: boolean;
// Actions
updateKeybinding: (key: string, action: ActionWithOptionalArgs) => void;
@@ -50,6 +51,8 @@ interface KeybindingsState {
resetToDefaults: () => void;
importKeybindings: (config: KeybindingConfig) => void;
exportKeybindings: () => KeybindingConfig;
+ enableKeybindings: () => void;
+ disableKeybindings: () => void;
// Validation
validateKeybinding: (
@@ -67,6 +70,7 @@ export const useKeybindingsStore = create<KeybindingsState>()(
(set, get) => ({
keybindings: { ...defaultKeybindings },
isCustomized: false,
+ keybindingsEnabled: true,
updateKeybinding: (key: string, action: ActionWithOptionalArgs) => {
set((state) => {
@@ -99,6 +103,14 @@ export const useKeybindingsStore = create<KeybindingsState>()(
});
},
+ enableKeybindings: () => {
+ set({ keybindingsEnabled: true });
+ },
+
+ disableKeybindings: () => {
+ set({ keybindingsEnabled: false });
+ },
+
importKeybindings: (config: KeybindingConfig) => {
set({
keybindings: { ...config },