2311 embed keyboard shortcuts (#2507)
* 2311-feat(front): AppHotKeyScope and CustomHotKeyScopes configured * 2311-feat(front): Groups and Items added * 2311-fix: pr requested changes --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -5,6 +5,7 @@ import { HotkeyScope } from '../types/HotkeyScope';
|
||||
export const DEFAULT_HOTKEYS_SCOPE_CUSTOM_SCOPES: CustomHotkeyScopes = {
|
||||
commandMenu: true,
|
||||
goto: false,
|
||||
keyboardShortcutMenu: true,
|
||||
};
|
||||
|
||||
export const INITIAL_HOTKEYS_SCOPE: HotkeyScope = {
|
||||
@ -12,5 +13,6 @@ export const INITIAL_HOTKEYS_SCOPE: HotkeyScope = {
|
||||
customScopes: {
|
||||
commandMenu: true,
|
||||
goto: true,
|
||||
keyboardShortcutMenu: true,
|
||||
},
|
||||
};
|
||||
|
||||
@ -15,7 +15,8 @@ const isCustomScopesEqual = (
|
||||
) => {
|
||||
return (
|
||||
customScopesA?.commandMenu === customScopesB?.commandMenu &&
|
||||
customScopesA?.goto === customScopesB?.goto
|
||||
customScopesA?.goto === customScopesB?.goto &&
|
||||
customScopesA?.keyboardShortcutMenu === customScopesB?.keyboardShortcutMenu
|
||||
);
|
||||
};
|
||||
|
||||
@ -54,6 +55,7 @@ export const useSetHotkeyScope = () =>
|
||||
customScopes: {
|
||||
commandMenu: customScopes?.commandMenu ?? true,
|
||||
goto: customScopes?.goto ?? false,
|
||||
keyboardShortcutMenu: customScopes?.keyboardShortcutMenu ?? true,
|
||||
},
|
||||
};
|
||||
|
||||
@ -67,6 +69,10 @@ export const useSetHotkeyScope = () =>
|
||||
scopesToSet.push(AppHotkeyScope.Goto);
|
||||
}
|
||||
|
||||
if (newHotkeyScope?.customScopes?.keyboardShortcutMenu) {
|
||||
scopesToSet.push(AppHotkeyScope.KeyboardShortcutMenu);
|
||||
}
|
||||
|
||||
scopesToSet.push(newHotkeyScope.scope);
|
||||
set(internalHotkeysEnabledScopesState, scopesToSet);
|
||||
set(currentHotkeyScopeState, newHotkeyScope);
|
||||
|
||||
@ -2,4 +2,5 @@ export enum AppHotkeyScope {
|
||||
App = 'app',
|
||||
Goto = 'goto',
|
||||
CommandMenu = 'command-menu',
|
||||
KeyboardShortcutMenu = 'keyboard-shortcut-menu',
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
export type CustomHotkeyScopes = {
|
||||
goto?: boolean;
|
||||
commandMenu?: boolean;
|
||||
keyboardShortcutMenu?: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user