608 fix hotkey scope and dropdown issues in the command menu (#11121)
Closes https://github.com/twentyhq/core-team-issues/issues/608 - Introduces a new hotkey scope `CommandMenuFocused` - Fixes hotkey scopes issues in the side panel
This commit is contained in:
@ -62,7 +62,7 @@ export const useDropdownV2 = () => {
|
||||
|
||||
const toggleDropdown = useRecoilCallback(
|
||||
({ snapshot }) =>
|
||||
(specificComponentId: string) => {
|
||||
(specificComponentId: string, customHotkeyScope?: HotkeyScope) => {
|
||||
const scopeId = getScopeIdFromComponentId(specificComponentId);
|
||||
const isDropdownOpen = snapshot
|
||||
.getLoadable(isDropdownOpenComponentState({ scopeId }))
|
||||
@ -71,7 +71,7 @@ export const useDropdownV2 = () => {
|
||||
if (isDropdownOpen) {
|
||||
closeDropdown(specificComponentId);
|
||||
} else {
|
||||
openDropdown(specificComponentId);
|
||||
openDropdown(specificComponentId, customHotkeyScope);
|
||||
}
|
||||
},
|
||||
[closeDropdown, openDropdown],
|
||||
|
||||
@ -3,13 +3,13 @@ import { useRecoilCallback } from 'recoil';
|
||||
import { DEBUG_HOTKEY_SCOPE } from '@/ui/utilities/hotkey/hooks/useScopedHotkeyCallback';
|
||||
import { logDebug } from '~/utils/logDebug';
|
||||
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { DEFAULT_HOTKEYS_SCOPE_CUSTOM_SCOPES } from '../constants/DefaultHotkeysScopeCustomScopes';
|
||||
import { currentHotkeyScopeState } from '../states/internal/currentHotkeyScopeState';
|
||||
import { internalHotkeysEnabledScopesState } from '../states/internal/internalHotkeysEnabledScopesState';
|
||||
import { AppHotkeyScope } from '../types/AppHotkeyScope';
|
||||
import { CustomHotkeyScopes } from '../types/CustomHotkeyScope';
|
||||
import { HotkeyScope } from '../types/HotkeyScope';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
const isCustomScopesEqual = (
|
||||
customScopesA: CustomHotkeyScopes | undefined,
|
||||
@ -69,6 +69,10 @@ export const useSetHotkeyScope = () =>
|
||||
scopesToSet.push(AppHotkeyScope.CommandMenu);
|
||||
}
|
||||
|
||||
if (newHotkeyScope.customScopes?.commandMenuOpen === true) {
|
||||
scopesToSet.push(AppHotkeyScope.CommandMenuOpen);
|
||||
}
|
||||
|
||||
if (newHotkeyScope?.customScopes?.goto === true) {
|
||||
scopesToSet.push(AppHotkeyScope.Goto);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user