From eba997be9867024deabe4250d3a0361b6c7d411e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Bosi?=
<71827178+bosiraphael@users.noreply.github.com>
Date: Wed, 9 Jul 2025 17:21:14 +0200
Subject: [PATCH] =?UTF-8?q?Replace=20hotkey=20scopes=20by=20focus=20stack?=
=?UTF-8?q?=20(Part=206=20-=20Remove=20Hotkey=20scopes=20=F0=9F=AB=B3?=
=?UTF-8?q?=F0=9F=8E=A4)=20(#13127)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
# Replace hotkey scopes by focus stack (Part 6 - Remove Hotkey scopes)
This PR is the last part of a refactoring aiming to deprecate the hotkey
scopes api in favor of the new focus stack api which is more robust.
Part 1: https://github.com/twentyhq/twenty/pull/12673
Part 2: https://github.com/twentyhq/twenty/pull/12798
Part 3: https://github.com/twentyhq/twenty/pull/12910
Part 4: https://github.com/twentyhq/twenty/pull/12933
Part 5: https://github.com/twentyhq/twenty/pull/13106
In this part, we completely remove the hotkey scopes.
---
.../inheritActionsFromDefaultConfig.test.tsx | 324 ++++++++++++++++++
.../components/CmdEnterActionButton.tsx | 2 -
.../CommandMenuActionMenuDropdown.tsx | 4 -
.../RecordIndexActionMenuDropdown.tsx | 2 -
.../RecordShowRightDrawerOpenRecordButton.tsx | 2 -
.../components/ActivityRichTextEditor.tsx | 10 +-
.../useOpenActivityTargetCellEditMode.ts | 6 +-
.../types/ActivityEditorHotkeyScope.ts | 4 -
.../effect-components/PageChangeEffect.tsx | 49 ---
.../components/CommandMenuList.tsx | 2 -
.../components/CommandMenuOpenContainer.tsx | 10 +-
.../hooks/__tests__/useCommandMenu.test.tsx | 43 ---
.../hooks/useCommandMenuHistory.ts | 107 +++---
.../hooks/useCommandMenuHotKeys.ts | 35 +-
.../hooks/useNavigateCommandMenu.ts | 9 +-
.../types/CommandMenuHotkeyScope.ts | 3 -
.../CurrentWorkspaceMemberFavorites.tsx | 1 -
.../favorites/components/FavoritesFolders.tsx | 4 -
...oriteFolderRightIconDropdownHotkeyScope.ts | 4 -
.../components/FavoriteFolderPicker.tsx | 3 -
.../components/KeyboardShortcutMenu.tsx | 2 -
.../KeyboardShortcutMenuOpenContent.tsx | 2 -
.../useKeyboardShortcutMenu.test.tsx | 7 -
.../hooks/useKeyboardShortcutMenu.ts | 5 -
.../AdvancedFilterFieldSelectMenu.tsx | 2 -
...FilterRecordFilterOperandSelectContent.tsx | 2 -
.../AdvancedFilterSubFieldSelectMenu.tsx | 2 -
...SelectFieldUsedInAdvancedFilterDropdown.ts | 5 -
.../ObjectFilterDropdownBooleanSelect.tsx | 2 -
.../ObjectFilterDropdownOptionSelect.tsx | 3 -
.../ObjectOptionsDropdownLayoutContent.tsx | 2 -
...jectOptionsDropdownLayoutOpenInContent.tsx | 2 -
.../ObjectOptionsDropdownMenuContent.tsx | 2 -
.../ObjectOptionsDropdownMenuViewName.tsx | 2 -
...tOptionsDropdownRecordGroupSortContent.tsx | 2 -
...jectOptionsDropdownRecordGroupsContent.tsx | 3 -
.../components/ObjectSortDropdownButton.tsx | 7 -
.../RecordBoardBodyEscapeHotkeyEffect.tsx | 5 +-
.../components/RecordBoardHotkeyEffect.tsx | 4 +-
.../hooks/useFocusedRecordBoardCard.ts | 10 -
.../hooks/useRecordBoardArrowKeysEffect.ts | 5 -
.../hooks/useRecordBoardCardHotkeys.ts | 10 +-
.../hooks/useRecordBoardSelectAllHotkeys.ts | 33 +-
.../record-board/hooks/useSelectAllCards.ts | 63 ++++
...allCardsSelectedStatusComponentSelector.ts | 37 ++
.../types/BoardColumnHotkeyScope.ts | 4 -
.../record-board/types/BoardHotkeyScope.ts | 3 -
.../components/FormDateTimeFieldInput.tsx | 9 +
.../FormFieldInputInnerContainer.tsx | 13 +-
.../components/FormMultiSelectFieldInput.tsx | 10 +-
.../components/FormNumberFieldInput.tsx | 1 -
.../components/FormSelectFieldInput.tsx | 4 -
.../components/FormSingleRecordPicker.tsx | 2 +-
.../components/FormUuidFieldInput.tsx | 1 -
.../constants/FormFieldInputHotKeyScope.ts | 3 -
.../FormMultiSelectFieldInputHotKeyScope.ts | 3 -
.../hooks/useOpenFieldInputEditMode.ts | 8 +-
.../input/components/AddressFieldInput.tsx | 2 -
.../input/components/ArrayFieldInput.tsx | 2 -
.../input/components/CurrencyFieldInput.tsx | 2 -
.../input/components/DateFieldInput.tsx | 2 -
.../input/components/DateTimeFieldInput.tsx | 2 -
.../input/components/EmailsFieldInput.tsx | 2 -
.../input/components/FullNameFieldInput.tsx | 2 -
.../input/components/LinksFieldInput.tsx | 2 -
.../input/components/MultiItemBaseInput.tsx | 3 -
.../input/components/MultiItemFieldInput.tsx | 14 +-
.../input/components/NumberFieldInput.tsx | 2 -
.../input/components/PhonesFieldInput.tsx | 2 -
.../input/components/RawJsonFieldInput.tsx | 8 +-
.../input/components/RichTextFieldInput.tsx | 2 -
.../input/components/SelectFieldInput.tsx | 2 -
.../input/components/TextFieldInput.tsx | 2 -
.../__stories__/AddressFieldInput.stories.tsx | 3 -
.../__stories__/ArrayFieldInput.stories.tsx | 2 -
.../DateTimeFieldInput.stories.tsx | 2 -
.../__stories__/EmailsFieldInput.stories.tsx | 2 -
.../__stories__/LinksFieldInput.stories.tsx | 2 -
.../MultiItemBaseInput.stories.tsx | 4 +-
.../__stories__/NumberFieldInput.stories.tsx | 2 -
.../__stories__/PhonesFieldInput.stories.tsx | 2 -
.../__stories__/RatingFieldInput.stories.tsx | 2 -
.../RelationFromManyFieldInput.stories.tsx | 2 -
.../RelationToOneFieldInput.stories.tsx | 3 -
.../RichTextFieldInput.stories.tsx | 2 -
.../__stories__/TextFieldInput.stories.tsx | 2 -
.../useOpenRelationFromManyFieldInput.tsx | 6 +-
.../hooks/useOpenRelationToOneFieldInput.tsx | 7 +-
.../input/hooks/useRegisterInputEvents.ts | 8 +-
.../hooks/useResetFocusStackToRecordIndex.ts | 10 -
.../types/RecordIndexHotkeyScope.ts | 3 -
.../components/RecordInlineCell.tsx | 18 +-
...ustomEditHotkeyScopeForFieldScopedState.ts | 10 -
.../parentHotkeyScopeForFieldScopedState.ts | 10 -
.../types/InlineCellHotkeyScope.ts | 3 -
.../components/MultipleRecordPicker.tsx | 2 -
.../MultipleRecordPickerMenuItems.tsx | 2 -
.../SingleRecordPickerMenuItems.tsx | 7 +-
.../components/RecordTableWithWrappers.tsx | 17 +-
.../hooks/internal/useSelectAllRows.ts | 8 +
.../hooks/useFocusedRecordTableRow.ts | 10 -
.../hooks/useRecordTableRowFocusHotkeys.ts | 4 -
.../RecordTableBodyEscapeHotkeyEffect.tsx | 2 -
...RecordTableBodyFocusClickOutsideEffect.tsx | 9 -
.../RecordTableBodyFocusKeyboardEffect.tsx | 2 -
.../RecordTableCellArrowKeysEffect.tsx | 2 -
.../components/RecordTableCellFieldInput.tsx | 17 +-
.../RecordTableCellHotkeysEffect.tsx | 25 +-
.../useMoveHoverToCurrentCell.test.tsx | 11 +-
.../hooks/useFocusRecordTableCell.ts | 8 +-
.../hooks/useMoveHoverToCurrentCell.ts | 17 -
.../hooks/useOpenRecordTableCellFromCell.ts | 7 -
.../hooks/useOpenRecordTableCellV2.ts | 6 -
.../hooks/useRecordTableCellFocusHotkeys.ts | 6 -
.../RecordTableRowArrowKeysEffect.tsx | 2 -
.../hooks/useRecordTableRowHotkeys.ts | 29 +-
.../record-table/types/TableHotkeyScope.ts | 3 -
.../types/TableOptionsHotkeyScope.ts | 3 -
.../components/RecordTitleCellFieldInput.tsx | 3 -
.../RecordTitleCellTextFieldInput.tsx | 3 -
.../components/RecordTitleDoubleTextInput.tsx | 6 -
.../RecordTitleFullNameFieldDisplay.tsx | 6 -
.../RecordTitleFullNameFieldInput.tsx | 3 -
.../hooks/useRecordTitleCell.tsx | 52 +--
.../components/MultipleSelectDropdown.tsx | 3 -
.../select/types/SelectFieldHotkeyScope.tsx | 3 -
.../components/SettingsRoleLabelContainer.tsx | 3 -
.../SettingsServerlessFunctionHotKeyScope.ts | 8 -
.../src/modules/types/PageHotkeyScope.ts | 10 -
.../dialog-manager/components/Dialog.tsx | 3 -
.../components/DialogManagerEffect.tsx | 6 -
.../dialog-manager/types/DialogHotkeyScope.ts | 3 -
.../field/input/components/AddressInput.tsx | 6 -
.../field/input/components/CurrencyInput.tsx | 3 -
.../ui/field/input/components/DateInput.tsx | 13 +-
.../input/components/DoubleTextInput.tsx | 6 -
.../input/components/MultiSelectInput.tsx | 3 -
.../ui/field/input/components/SelectInput.tsx | 2 -
.../field/input/components/TextAreaInput.tsx | 3 -
.../ui/field/input/components/TextInput.tsx | 3 -
.../__stories__/MultiSelectInput.stories.tsx | 26 +-
.../ui/input/components/IconPicker.tsx | 2 -
.../modules/ui/input/components/Select.tsx | 2 -
.../modules/ui/input/components/TextArea.tsx | 2 -
.../modules/ui/input/components/TextInput.tsx | 4 -
.../ui/input/components/TitleInput.tsx | 6 -
.../__stories__/TitleInput.stories.tsx | 2 -
.../CurrencyPickerDropdownButton.tsx | 6 +-
.../types/CurrencyPickerHotkeyScope.ts | 3 -
.../phone/types/CountryPickerHotkeyScope.ts | 3 -
.../ui/input/types/InputHotkeyScope.ts | 3 -
.../ui/input/types/TitleInputHotkeyScope.ts | 3 -
.../dropdown/components/DropdownMenuInput.tsx | 3 -
.../__stories__/Dropdown.stories.tsx | 15 -
.../__stories__/DropdownMenuInput.stories.tsx | 4 +-
.../internal/DropdownInternalContainer.tsx | 2 -
.../dropdown/constants/DropdownHotkeyScope.ts | 3 -
.../layout/dropdown/hooks/useOpenDropdown.ts | 4 -
.../ui/layout/modal/components/Modal.tsx | 2 -
.../ModalHotkeysAndClickOutsideEffect.tsx | 5 -
.../__stories__/ConfirmationModal.stories.tsx | 15 -
.../components/__stories__/Modal.stories.tsx | 15 -
.../components/types/ModalHotkeyScope.ts | 3 -
.../modal/hooks/__tests__/useModal.spec.ts | 13 -
.../ui/layout/modal/hooks/useModal.tsx | 12 -
.../components/SelectableList.tsx | 11 +-
.../SelectableListItemHotkeyEffect.tsx | 3 +-
.../internal/useSelectableListHotKeys.ts | 6 -
...SelectableListListenToEnterHotkeyOnItem.ts | 4 -
.../states/contexts/SelectableListContext.tsx | 1 -
.../components/NavigationDrawerInput.tsx | 8 +-
.../types/NavigationDrawerHotKeyScope.ts | 3 -
.../focus/constants/DebugFocusStack.ts | 4 +-
.../usePushFocusItemToFocusStack.test.tsx | 6 -
...RemoveFocusItemFromFocusStackById.test.tsx | 10 -
.../__tests__/useResetFocusStack.test.tsx | 3 -
.../useResetFocusStackToFocusItem.test.tsx | 8 -
.../hooks/usePushFocusItemToFocusStack.ts | 20 +-
...eFocusItemFromFocusStackByComponentType.ts | 8 +-
.../useRemoveFocusItemFromFocusStackById.ts | 8 +-
.../focus/hooks/useResetFocusStack.ts | 8 +-
.../hooks/useResetFocusStackToFocusItem.ts | 21 +-
.../utilities/focus/types/FocusStackItem.ts | 1 -
.../hotkey/components/HotkeyEffect.tsx | 2 -
.../hotkey/constants/DebugHotkeyScope.ts | 1 -
.../DefaultHotkeysScopeCustomScopes.ts | 7 -
.../hotkey/constants/InitialHotkeysScope.ts | 11 -
.../hooks/__tests__/useGoToHotkeys.test.tsx | 7 -
.../hotkey/hooks/useGlobalHotkeys.ts | 3 -
.../hotkey/hooks/useGlobalHotkeysCallback.ts | 44 +--
.../hotkey/hooks/useGlobalHotkeysSequence.ts | 7 +-
.../utilities/hotkey/hooks/useGoToHotkeys.ts | 2 -
.../hooks/useHotkeysOnFocusedElement.ts | 5 -
.../useHotkeysOnFocusedElementCallback.ts | 29 +-
.../hotkey/hooks/usePreviousHotkeyScope.ts | 81 -----
.../hotkey/hooks/useSetHotkeyScope.ts | 104 ------
.../internal/currentHotkeyScopeState.ts | 8 -
.../internalHotkeysEnabledScopesState.ts | 5 -
.../previousHotkeyScopeFamilyState.ts | 11 -
.../utilities/hotkey/types/AppHotkeyScope.ts | 9 -
.../hotkey/types/CustomHotkeyScope.ts | 7 -
.../ui/utilities/hotkey/types/HotkeyScope.ts | 6 -
.../components/UpdateViewButtonGroup.tsx | 5 -
.../ViewBarFilterDropdownFieldSelectMenu.tsx | 2 -
.../ViewBarFilterDropdown.stories.tsx | 5 -
...temFromViewBarFilterDropdown.test.test.tsx | 6 +-
...ldMetadataItemFromViewBarFilterDropdown.ts | 6 +-
.../ViewPickerContentCreateMode.tsx | 2 -
.../components/ViewPickerContentEditMode.tsx | 2 -
.../components/WorkflowStepHeader.tsx | 1 -
.../ai-agent-action/hooks/useAgentChat.ts | 2 -
.../src/pages/onboarding/CreateProfile.tsx | 8 +-
.../src/pages/onboarding/InviteTeam.tsx | 2 -
.../src/pages/onboarding/SyncEmails.tsx | 2 -
.../testing/InitializeHotkeyStorybookHook.tsx | 18 -
215 files changed, 687 insertions(+), 1424 deletions(-)
create mode 100644 packages/twenty-front/src/modules/action-menu/actions/record-actions/utils/__tests__/inheritActionsFromDefaultConfig.test.tsx
delete mode 100644 packages/twenty-front/src/modules/activities/types/ActivityEditorHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/command-menu/types/CommandMenuHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/favorites/constants/FavoriteFolderRightIconDropdownHotkeyScope.ts
create mode 100644 packages/twenty-front/src/modules/object-record/record-board/hooks/useSelectAllCards.ts
create mode 100644 packages/twenty-front/src/modules/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-board/types/BoardColumnHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-board/types/BoardHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-field/form-types/constants/FormFieldInputHotKeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-field/form-types/constants/FormMultiSelectFieldInputHotKeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-index/types/RecordIndexHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-inline-cell/states/customEditHotkeyScopeForFieldScopedState.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-inline-cell/states/parentHotkeyScopeForFieldScopedState.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-inline-cell/types/InlineCellHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-table/types/TableHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/record-table/types/TableOptionsHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/object-record/select/types/SelectFieldHotkeyScope.tsx
delete mode 100644 packages/twenty-front/src/modules/settings/serverless-functions/types/SettingsServerlessFunctionHotKeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/types/PageHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/feedback/dialog-manager/types/DialogHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/input/components/internal/currency/types/CurrencyPickerHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/input/components/internal/phone/types/CountryPickerHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/input/types/InputHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/input/types/TitleInputHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/layout/dropdown/constants/DropdownHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/layout/modal/components/types/ModalHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/navigation/navigation-drawer/types/NavigationDrawerHotKeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/constants/DebugHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/constants/DefaultHotkeysScopeCustomScopes.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/constants/InitialHotkeysScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/usePreviousHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useSetHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/currentHotkeyScopeState.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/previousHotkeyScopeFamilyState.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/types/AppHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/types/CustomHotkeyScope.ts
delete mode 100644 packages/twenty-front/src/modules/ui/utilities/hotkey/types/HotkeyScope.ts
delete mode 100644 packages/twenty-front/src/testing/InitializeHotkeyStorybookHook.tsx
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/utils/__tests__/inheritActionsFromDefaultConfig.test.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/utils/__tests__/inheritActionsFromDefaultConfig.test.tsx
new file mode 100644
index 000000000..12408a7df
--- /dev/null
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/utils/__tests__/inheritActionsFromDefaultConfig.test.tsx
@@ -0,0 +1,324 @@
+import { DEFAULT_RECORD_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/constants/DefaultRecordActionsConfig';
+import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKeys';
+import { SingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey';
+import { ActionConfig } from '@/action-menu/actions/types/ActionConfig';
+import { ActionScope } from '@/action-menu/actions/types/ActionScope';
+import { ActionType } from '@/action-menu/actions/types/ActionType';
+import { DefaultRecordActionConfigKeys } from '@/action-menu/actions/types/DefaultRecordActionConfigKeys';
+import { IconHeart, IconPlus } from 'twenty-ui/display';
+import { inheritActionsFromDefaultConfig } from '../inheritActionsFromDefaultConfig';
+
+const MockComponent =
Mock Component
;
+
+describe('inheritActionsFromDefaultConfig', () => {
+ it('should return empty object when no action keys are provided', () => {
+ const result = inheritActionsFromDefaultConfig({
+ config: {},
+ actionKeys: [],
+ propertiesToOverwrite: {},
+ });
+
+ expect(result).toEqual({});
+ });
+
+ it('should return only provided config when no default action keys are specified', () => {
+ const customConfig: Record = {
+ 'custom-action': {
+ type: ActionType.Standard,
+ scope: ActionScope.Object,
+ key: 'custom-action',
+ label: 'Custom Action',
+ position: 100,
+ Icon: IconPlus,
+ shouldBeRegistered: () => true,
+ component: MockComponent,
+ },
+ };
+
+ const result = inheritActionsFromDefaultConfig({
+ config: customConfig,
+ actionKeys: [],
+ propertiesToOverwrite: {},
+ });
+
+ expect(result).toEqual(customConfig);
+ });
+
+ it('should inherit actions from default config', () => {
+ const actionKeys: DefaultRecordActionConfigKeys[] = [
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
+ SingleRecordActionKeys.ADD_TO_FAVORITES,
+ ];
+
+ const result = inheritActionsFromDefaultConfig({
+ config: {},
+ actionKeys,
+ propertiesToOverwrite: {},
+ });
+
+ expect(result).toEqual({
+ [NoSelectionRecordActionKeys.CREATE_NEW_RECORD]:
+ DEFAULT_RECORD_ACTIONS_CONFIG[
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD
+ ],
+ [SingleRecordActionKeys.ADD_TO_FAVORITES]:
+ DEFAULT_RECORD_ACTIONS_CONFIG[SingleRecordActionKeys.ADD_TO_FAVORITES],
+ });
+ });
+
+ it('should overwrite specific properties of inherited actions', () => {
+ const actionKeys: DefaultRecordActionConfigKeys[] = [
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
+ ];
+
+ const propertiesToOverwrite = {
+ [NoSelectionRecordActionKeys.CREATE_NEW_RECORD]: {
+ label: 'Custom Create Label',
+ position: 999,
+ isPinned: false,
+ },
+ };
+
+ const result = inheritActionsFromDefaultConfig({
+ config: {},
+ actionKeys,
+ propertiesToOverwrite,
+ });
+
+ const expectedAction = {
+ ...DEFAULT_RECORD_ACTIONS_CONFIG[
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD
+ ],
+ label: 'Custom Create Label',
+ position: 999,
+ isPinned: false,
+ };
+
+ expect(result).toEqual({
+ [NoSelectionRecordActionKeys.CREATE_NEW_RECORD]: expectedAction,
+ });
+ });
+
+ it('should overwrite properties for multiple actions', () => {
+ const actionKeys: DefaultRecordActionConfigKeys[] = [
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
+ SingleRecordActionKeys.ADD_TO_FAVORITES,
+ ];
+
+ const propertiesToOverwrite = {
+ [NoSelectionRecordActionKeys.CREATE_NEW_RECORD]: {
+ position: 10,
+ },
+ [SingleRecordActionKeys.ADD_TO_FAVORITES]: {
+ label: 'Custom Favorite Label',
+ Icon: IconHeart,
+ },
+ };
+
+ const result = inheritActionsFromDefaultConfig({
+ config: {},
+ actionKeys,
+ propertiesToOverwrite,
+ });
+
+ expect(result[NoSelectionRecordActionKeys.CREATE_NEW_RECORD]).toEqual({
+ ...DEFAULT_RECORD_ACTIONS_CONFIG[
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD
+ ],
+ position: 10,
+ });
+
+ expect(result[SingleRecordActionKeys.ADD_TO_FAVORITES]).toEqual({
+ ...DEFAULT_RECORD_ACTIONS_CONFIG[SingleRecordActionKeys.ADD_TO_FAVORITES],
+ label: 'Custom Favorite Label',
+ Icon: IconHeart,
+ });
+ });
+
+ it('should only overwrite properties for specified actions', () => {
+ const actionKeys: DefaultRecordActionConfigKeys[] = [
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
+ SingleRecordActionKeys.ADD_TO_FAVORITES,
+ ];
+
+ const propertiesToOverwrite = {
+ [NoSelectionRecordActionKeys.CREATE_NEW_RECORD]: {
+ position: 10,
+ },
+ };
+
+ const result = inheritActionsFromDefaultConfig({
+ config: {},
+ actionKeys,
+ propertiesToOverwrite,
+ });
+
+ expect(result[NoSelectionRecordActionKeys.CREATE_NEW_RECORD]).toEqual({
+ ...DEFAULT_RECORD_ACTIONS_CONFIG[
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD
+ ],
+ position: 10,
+ });
+
+ expect(result[SingleRecordActionKeys.ADD_TO_FAVORITES]).toEqual(
+ DEFAULT_RECORD_ACTIONS_CONFIG[SingleRecordActionKeys.ADD_TO_FAVORITES],
+ );
+ });
+
+ it('should merge inherited actions with provided config', () => {
+ const customConfig: Record = {
+ 'custom-action': {
+ type: ActionType.Standard,
+ scope: ActionScope.Object,
+ key: 'custom-action',
+ label: 'Custom Action',
+ position: 100,
+ Icon: IconPlus,
+ shouldBeRegistered: () => true,
+ component: MockComponent,
+ },
+ };
+
+ const actionKeys: DefaultRecordActionConfigKeys[] = [
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
+ ];
+
+ const result = inheritActionsFromDefaultConfig({
+ config: customConfig,
+ actionKeys,
+ propertiesToOverwrite: {},
+ });
+
+ expect(result).toEqual({
+ [NoSelectionRecordActionKeys.CREATE_NEW_RECORD]:
+ DEFAULT_RECORD_ACTIONS_CONFIG[
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD
+ ],
+ 'custom-action': customConfig['custom-action'],
+ });
+ });
+
+ it('should prioritize provided config over inherited actions when keys conflict', () => {
+ const customConfig: Record = {
+ [NoSelectionRecordActionKeys.CREATE_NEW_RECORD]: {
+ type: ActionType.Standard,
+ scope: ActionScope.Object,
+ key: NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
+ label: 'Overridden Create Action',
+ position: 999,
+ Icon: IconHeart,
+ shouldBeRegistered: () => false,
+ component: MockComponent,
+ },
+ };
+
+ const actionKeys: DefaultRecordActionConfigKeys[] = [
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
+ ];
+
+ const result = inheritActionsFromDefaultConfig({
+ config: customConfig,
+ actionKeys,
+ propertiesToOverwrite: {},
+ });
+
+ expect(result[NoSelectionRecordActionKeys.CREATE_NEW_RECORD]).toEqual(
+ customConfig[NoSelectionRecordActionKeys.CREATE_NEW_RECORD],
+ );
+ expect(result[NoSelectionRecordActionKeys.CREATE_NEW_RECORD].label).toBe(
+ 'Overridden Create Action',
+ );
+ });
+
+ it('should handle complex scenario with inheritance, overrides, and custom config', () => {
+ const customConfig: Record = {
+ 'custom-action-1': {
+ type: ActionType.Standard,
+ scope: ActionScope.Object,
+ key: 'custom-action-1',
+ label: 'Custom Action 1',
+ position: 50,
+ Icon: IconPlus,
+ shouldBeRegistered: () => true,
+ component: MockComponent,
+ },
+ [SingleRecordActionKeys.ADD_TO_FAVORITES]: {
+ type: ActionType.Standard,
+ scope: ActionScope.RecordSelection,
+ key: SingleRecordActionKeys.ADD_TO_FAVORITES,
+ label: 'Completely Custom Favorites',
+ position: 1000,
+ Icon: IconHeart,
+ shouldBeRegistered: () => false,
+ component: MockComponent,
+ },
+ };
+
+ const actionKeys: DefaultRecordActionConfigKeys[] = [
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
+ SingleRecordActionKeys.ADD_TO_FAVORITES,
+ SingleRecordActionKeys.REMOVE_FROM_FAVORITES,
+ ];
+
+ const propertiesToOverwrite = {
+ [NoSelectionRecordActionKeys.CREATE_NEW_RECORD]: {
+ label: 'Modified Create Label',
+ position: 5,
+ },
+ [SingleRecordActionKeys.REMOVE_FROM_FAVORITES]: {
+ isPinned: false,
+ },
+ };
+
+ const result = inheritActionsFromDefaultConfig({
+ config: customConfig,
+ actionKeys,
+ propertiesToOverwrite,
+ });
+
+ expect(Object.keys(result)).toHaveLength(4);
+
+ expect(result['custom-action-1']).toEqual(customConfig['custom-action-1']);
+
+ expect(result[NoSelectionRecordActionKeys.CREATE_NEW_RECORD]).toEqual({
+ ...DEFAULT_RECORD_ACTIONS_CONFIG[
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD
+ ],
+ label: 'Modified Create Label',
+ position: 5,
+ });
+
+ expect(result[SingleRecordActionKeys.ADD_TO_FAVORITES]).toEqual(
+ customConfig[SingleRecordActionKeys.ADD_TO_FAVORITES],
+ );
+
+ expect(result[SingleRecordActionKeys.REMOVE_FROM_FAVORITES]).toEqual({
+ ...DEFAULT_RECORD_ACTIONS_CONFIG[
+ SingleRecordActionKeys.REMOVE_FROM_FAVORITES
+ ],
+ isPinned: false,
+ });
+ });
+
+ it('should handle empty overrides gracefully', () => {
+ const actionKeys: DefaultRecordActionConfigKeys[] = [
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD,
+ ];
+
+ const propertiesToOverwrite = {
+ [NoSelectionRecordActionKeys.CREATE_NEW_RECORD]: {},
+ };
+
+ const result = inheritActionsFromDefaultConfig({
+ config: {},
+ actionKeys,
+ propertiesToOverwrite,
+ });
+
+ expect(result[NoSelectionRecordActionKeys.CREATE_NEW_RECORD]).toEqual(
+ DEFAULT_RECORD_ACTIONS_CONFIG[
+ NoSelectionRecordActionKeys.CREATE_NEW_RECORD
+ ],
+ );
+ });
+});
diff --git a/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx b/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx
index e7076b5dd..2be7c8699 100644
--- a/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx
+++ b/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx
@@ -1,6 +1,5 @@
import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { Key } from 'ts-key-enum';
import { Button } from 'twenty-ui/input';
import { getOsControlSymbol } from 'twenty-ui/utilities';
@@ -18,7 +17,6 @@ export const CmdEnterActionButton = ({
keys: [`${Key.Control}+${Key.Enter}`, `${Key.Meta}+${Key.Enter}`],
callback: () => onClick(),
focusId: SIDE_PANEL_FOCUS_ID,
- scope: AppHotkeyScope.CommandMenuOpen,
dependencies: [onClick],
});
diff --git a/packages/twenty-front/src/modules/action-menu/components/CommandMenuActionMenuDropdown.tsx b/packages/twenty-front/src/modules/action-menu/components/CommandMenuActionMenuDropdown.tsx
index 2ce91d7c1..91e58282a 100644
--- a/packages/twenty-front/src/modules/action-menu/components/CommandMenuActionMenuDropdown.tsx
+++ b/packages/twenty-front/src/modules/action-menu/components/CommandMenuActionMenuDropdown.tsx
@@ -7,12 +7,10 @@ import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId';
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useToggleDropdown } from '@/ui/layout/dropdown/hooks/useToggleDropdown';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { useTheme } from '@emotion/react';
import { useContext } from 'react';
@@ -39,7 +37,6 @@ export const CommandMenuActionMenuDropdown = () => {
dropdownComponentInstanceIdFromProps: dropdownId,
});
},
- scope: AppHotkeyScope.CommandMenuOpen,
dependencies: [toggleDropdown],
};
@@ -86,7 +83,6 @@ export const CommandMenuActionMenuDropdown = () => {
selectableListInstanceId={actionMenuId}
focusId={dropdownId}
selectableItemIdArray={selectableItemIdArray}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{recordSelectionActions.map((action) => (
diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx
index ea5993d2e..8eed98530 100644
--- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx
+++ b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx
@@ -10,7 +10,6 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
@@ -89,7 +88,6 @@ export const RecordIndexActionMenuDropdown = () => {
focusId={dropdownId}
selectableItemIdArray={selectedItemIdArray}
selectableListInstanceId={dropdownId}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{recordIndexActions.map((action) => (
diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx
index 181b55ea2..de06dc0cc 100644
--- a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx
+++ b/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx
@@ -13,7 +13,6 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { getShowPageTabListComponentId } from '@/ui/layout/show-page/utils/getShowPageTabListComponentId';
import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext';
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
@@ -123,7 +122,6 @@ export const RecordShowRightDrawerOpenRecordButton = ({
keys: ['ctrl+Enter,meta+Enter'],
callback: handleOpenRecord,
focusId: SIDE_PANEL_FOCUS_ID,
- scope: AppHotkeyScope.CommandMenuOpen,
dependencies: [handleOpenRecord],
});
diff --git a/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx b/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx
index d4b997c97..abbd27fac 100644
--- a/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx
+++ b/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx
@@ -5,7 +5,6 @@ import { v4 } from 'uuid';
import { useUploadAttachmentFile } from '@/activities/files/hooks/useUploadAttachmentFile';
import { useUpsertActivity } from '@/activities/hooks/useUpsertActivity';
import { canCreateActivityState } from '@/activities/states/canCreateActivityState';
-import { ActivityEditorHotkeyScope } from '@/activities/types/ActivityEditorHotkeyScope';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { modifyRecordFromCache } from '@/object-record/cache/utils/modifyRecordFromCache';
@@ -23,6 +22,7 @@ import { Task } from '@/activities/types/Task';
import { filterAttachmentsToRestore } from '@/activities/utils/filterAttachmentsToRestore';
import { getActivityAttachmentIdsToDelete } from '@/activities/utils/getActivityAttachmentIdsToDelete';
import { getActivityAttachmentPathsToRestore } from '@/activities/utils/getActivityAttachmentPathsToRestore';
+import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId';
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
import { useDeleteManyRecords } from '@/object-record/hooks/useDeleteManyRecords';
import { useLazyFetchAllRecords } from '@/object-record/hooks/useLazyFetchAllRecords';
@@ -307,7 +307,6 @@ export const ActivityRichTextEditor = ({
editor.domElement?.blur();
},
focusId: activityId,
- scope: ActivityEditorHotkeyScope.ActivityBody,
dependencies: [editor],
});
@@ -346,8 +345,7 @@ export const ActivityRichTextEditor = ({
useHotkeysOnFocusedElement({
keys: '*',
callback: handleAllKeys,
- focusId: activityId,
- scope: ActivityEditorHotkeyScope.ActivityBody,
+ focusId: SIDE_PANEL_FOCUS_ID,
dependencies: [handleAllKeys],
});
@@ -380,8 +378,8 @@ export const ActivityRichTextEditor = ({
type: FocusComponentType.ACTIVITY_RICH_TEXT_EDITOR,
},
focusId: activityId,
- hotkeyScope: {
- scope: ActivityEditorHotkeyScope.ActivityBody,
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
},
});
},
diff --git a/packages/twenty-front/src/modules/activities/inline-cell/hooks/useOpenActivityTargetCellEditMode.ts b/packages/twenty-front/src/modules/activities/inline-cell/hooks/useOpenActivityTargetCellEditMode.ts
index cfadbfc69..e2d54e182 100644
--- a/packages/twenty-front/src/modules/activities/inline-cell/hooks/useOpenActivityTargetCellEditMode.ts
+++ b/packages/twenty-front/src/modules/activities/inline-cell/hooks/useOpenActivityTargetCellEditMode.ts
@@ -6,7 +6,6 @@ import { useMultipleRecordPickerPerformSearch } from '@/object-record/record-pic
import { multipleRecordPickerPickableMorphItemsComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState';
import { multipleRecordPickerSearchFilterComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchFilterComponentState';
import { multipleRecordPickerSearchableObjectMetadataItemsComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchableObjectMetadataItemsComponentState';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { useRecoilCallback } from 'recoil';
@@ -95,10 +94,9 @@ export const useOpenActivityTargetCellEditMode = () => {
type: FocusComponentType.DROPDOWN,
instanceId: recordPickerInstanceId,
},
- hotkeyScope: {
- scope: DropdownHotkeyScope.Dropdown,
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: recordPickerInstanceId,
});
},
[
diff --git a/packages/twenty-front/src/modules/activities/types/ActivityEditorHotkeyScope.ts b/packages/twenty-front/src/modules/activities/types/ActivityEditorHotkeyScope.ts
deleted file mode 100644
index 46aed8941..000000000
--- a/packages/twenty-front/src/modules/activities/types/ActivityEditorHotkeyScope.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export enum ActivityEditorHotkeyScope {
- ActivityTitle = 'activity-title',
- ActivityBody = 'activity-body',
-}
diff --git a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx
index a876b3bd2..1ff100cba 100644
--- a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx
+++ b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx
@@ -32,7 +32,6 @@ import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/u
import { AppBasePath } from '@/types/AppBasePath';
import { AppPath } from '@/types/AppPath';
import { PageFocusId } from '@/types/PageFocusId';
-import { PageHotkeyScope } from '@/types/PageHotkeyScope';
import { useResetFocusStackToFocusItem } from '@/ui/utilities/focus/hooks/useResetFocusStackToFocusItem';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
@@ -153,15 +152,6 @@ export const PageChangeEffect = () => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: PageHotkeyScope.RecordShowPage,
- customScopes: {
- goto: true,
- keyboardShortcutMenu: true,
- searchRecords: true,
- },
},
});
break;
@@ -178,10 +168,6 @@ export const PageChangeEffect = () => {
enableGlobalHotkeysWithModifiers: false,
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: PageHotkeyScope.SignInUp,
},
});
break;
@@ -198,10 +184,6 @@ export const PageChangeEffect = () => {
enableGlobalHotkeysWithModifiers: false,
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: PageHotkeyScope.InviteTeam,
},
});
break;
@@ -218,10 +200,6 @@ export const PageChangeEffect = () => {
enableGlobalHotkeysWithModifiers: false,
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: PageHotkeyScope.CreateProfile,
},
});
break;
@@ -238,10 +216,6 @@ export const PageChangeEffect = () => {
enableGlobalHotkeysWithModifiers: false,
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: PageHotkeyScope.CreateWorkspace,
},
});
break;
@@ -258,10 +232,6 @@ export const PageChangeEffect = () => {
enableGlobalHotkeysWithModifiers: false,
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: PageHotkeyScope.SyncEmail,
},
});
break;
@@ -278,10 +248,6 @@ export const PageChangeEffect = () => {
enableGlobalHotkeysWithModifiers: false,
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: PageHotkeyScope.InviteTeam,
},
});
break;
@@ -298,10 +264,6 @@ export const PageChangeEffect = () => {
enableGlobalHotkeysWithModifiers: false,
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: PageHotkeyScope.PlanRequired,
},
});
break;
@@ -318,17 +280,6 @@ export const PageChangeEffect = () => {
enableGlobalHotkeysWithModifiers: false,
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: PageHotkeyScope.Settings,
- customScopes: {
- goto: false,
- keyboardShortcutMenu: false,
- commandMenu: false,
- commandMenuOpen: false,
- searchRecords: false,
- },
},
});
break;
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx
index b38e6934e..7a5d4d0be 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx
@@ -7,7 +7,6 @@ import { COMMAND_MENU_SEARCH_BAR_PADDING } from '@/command-menu/constants/Comman
import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId';
import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import styled from '@emotion/styled';
import { useSetRecoilState } from 'recoil';
@@ -78,7 +77,6 @@ export const CommandMenuList = ({
selectableListInstanceId="command-menu-list"
focusId={SIDE_PANEL_FOCUS_ID}
selectableItemIdArray={selectableItemIds}
- hotkeyScope={AppHotkeyScope.CommandMenuOpen}
onSelect={() => {
setHasUserSelectedCommand(true);
}}
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx
index b4b76a244..3ba4e4b26 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx
@@ -1,13 +1,13 @@
import { COMMAND_MENU_ANIMATION_VARIANTS } from '@/command-menu/constants/CommandMenuAnimationVariants';
import { COMMAND_MENU_CLICK_OUTSIDE_ID } from '@/command-menu/constants/CommandMenuClickOutsideId';
+import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { CommandMenuAnimationVariant } from '@/command-menu/types/CommandMenuAnimationVariant';
-import { CommandMenuHotkeyScope } from '@/command-menu/types/CommandMenuHotkeyScope';
import { RECORD_CHIP_CLICK_OUTSIDE_ID } from '@/object-record/record-table/constants/RecordChipClickOutsideId';
import { SLASH_MENU_DROPDOWN_CLICK_OUTSIDE_ID } from '@/ui/input/constants/SlashMenuDropdownClickOutsideId';
import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';
import { PAGE_HEADER_COMMAND_MENU_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/page-header/constants/PageHeaderCommandMenuButtonClickOutsideId';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
+import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { WORKFLOW_DIAGRAM_CREATE_STEP_NODE_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramCreateStepNodeClickOutsideId';
import { WORKFLOW_DIAGRAM_EDGE_OPTIONS_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramEdgeOptionsClickOutsideId';
@@ -55,11 +55,11 @@ export const CommandMenuOpenContainer = ({
const handleClickOutside = useRecoilCallback(
({ snapshot }) =>
(event: MouseEvent | TouchEvent) => {
- const hotkeyScope = snapshot
- .getLoadable(currentHotkeyScopeState)
+ const currentFocusId = snapshot
+ .getLoadable(currentFocusIdSelector)
.getValue();
- if (hotkeyScope?.scope === CommandMenuHotkeyScope.CommandMenuFocused) {
+ if (currentFocusId === SIDE_PANEL_FOCUS_ID) {
event.stopImmediatePropagation();
event.preventDefault();
closeCommandMenu();
diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenu.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenu.test.tsx
index f1ea6ccf6..ecc943a04 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenu.test.tsx
+++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenu.test.tsx
@@ -8,18 +8,6 @@ import { commandMenuNavigationStackState } from '@/command-menu/states/commandMe
import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState';
import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState';
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
-import { CommandMenuHotkeyScope } from '@/command-menu/types/CommandMenuHotkeyScope';
-
-const mockGoBackToPreviousHotkeyScope = jest.fn();
-const mockSetHotkeyScopeAndMemorizePreviousScope = jest.fn();
-
-jest.mock('@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope', () => ({
- usePreviousHotkeyScope: () => ({
- goBackToPreviousHotkeyScope: mockGoBackToPreviousHotkeyScope,
- setHotkeyScopeAndMemorizePreviousScope:
- mockSetHotkeyScopeAndMemorizePreviousScope,
- }),
-}));
const Wrapper = ({ children }: { children: React.ReactNode }) => (
@@ -71,13 +59,6 @@ describe('useCommandMenu', () => {
});
expect(result.current.isCommandMenuOpened).toBe(true);
- expect(mockSetHotkeyScopeAndMemorizePreviousScope).toHaveBeenCalledWith({
- scope: CommandMenuHotkeyScope.CommandMenuFocused,
- memoizeKey: 'command-menu',
- customScopes: {
- commandMenuOpen: true,
- },
- });
act(() => {
result.current.commandMenu.closeCommandMenu();
@@ -96,13 +77,6 @@ describe('useCommandMenu', () => {
});
expect(result.current.isCommandMenuOpened).toBe(true);
- expect(mockSetHotkeyScopeAndMemorizePreviousScope).toHaveBeenCalledWith({
- scope: CommandMenuHotkeyScope.CommandMenuFocused,
- memoizeKey: 'command-menu',
- customScopes: {
- commandMenuOpen: true,
- },
- });
act(() => {
result.current.commandMenu.toggleCommandMenu();
@@ -110,21 +84,4 @@ describe('useCommandMenu', () => {
expect(result.current.isCommandMenuOpened).toBe(false);
});
-
- it('should call goBackToPreviousHotkeyScope when closing the command menu', () => {
- const { result } = renderHooks();
-
- act(() => {
- result.current.commandMenu.openCommandMenu();
- });
-
- expect(result.current.isCommandMenuOpened).toBe(true);
- expect(mockGoBackToPreviousHotkeyScope).not.toHaveBeenCalled();
-
- act(() => {
- result.current.commandMenu.closeCommandMenu();
- });
-
- expect(mockGoBackToPreviousHotkeyScope).toHaveBeenCalledTimes(1);
- });
});
diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHistory.ts b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHistory.ts
index 7f5332c99..c9002abd7 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHistory.ts
+++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHistory.ts
@@ -6,15 +6,12 @@ import { commandMenuNavigationStackState } from '@/command-menu/states/commandMe
import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState';
import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState';
import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState';
-import { CommandMenuHotkeyScope } from '@/command-menu/types/CommandMenuHotkeyScope';
import { getShowPageTabListComponentId } from '@/ui/layout/show-page/utils/getShowPageTabListComponentId';
import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { isDefined } from 'twenty-shared/utils';
export const useCommandMenuHistory = () => {
const { closeCommandMenu } = useCommandMenu();
- const setHotkeyScope = useSetHotkeyScope();
const goBackFromCommandMenu = useRecoilCallback(
({ snapshot, set }) => {
@@ -69,78 +66,64 @@ export const useCommandMenuHistory = () => {
}
set(hasUserSelectedCommandState, false);
-
- setHotkeyScope(CommandMenuHotkeyScope.CommandMenuFocused, {
- commandMenuOpen: true,
- });
};
},
- [closeCommandMenu, setHotkeyScope],
+ [closeCommandMenu],
);
- const navigateCommandMenuHistory = useRecoilCallback(
- ({ snapshot, set }) => {
- return (pageIndex: number) => {
- const currentNavigationStack = snapshot
- .getLoadable(commandMenuNavigationStackState)
- .getValue();
+ const navigateCommandMenuHistory = useRecoilCallback(({ snapshot, set }) => {
+ return (pageIndex: number) => {
+ const currentNavigationStack = snapshot
+ .getLoadable(commandMenuNavigationStackState)
+ .getValue();
- const newNavigationStack = currentNavigationStack.slice(
- 0,
- pageIndex + 1,
+ const newNavigationStack = currentNavigationStack.slice(0, pageIndex + 1);
+
+ set(commandMenuNavigationStackState, newNavigationStack);
+
+ const newNavigationStackItem = newNavigationStack.at(-1);
+
+ if (!isDefined(newNavigationStackItem)) {
+ throw new Error(
+ `No command menu navigation stack item found for index ${pageIndex}`,
);
+ }
- set(commandMenuNavigationStackState, newNavigationStack);
+ set(commandMenuPageState, newNavigationStackItem.page);
+ set(commandMenuPageInfoState, {
+ title: newNavigationStackItem.pageTitle,
+ Icon: newNavigationStackItem.pageIcon,
+ instanceId: newNavigationStackItem.pageId,
+ });
+ const currentMorphItems = snapshot
+ .getLoadable(commandMenuNavigationMorphItemByPageState)
+ .getValue();
- const newNavigationStackItem = newNavigationStack.at(-1);
-
- if (!isDefined(newNavigationStackItem)) {
- throw new Error(
- `No command menu navigation stack item found for index ${pageIndex}`,
+ for (const [pageId, morphItem] of currentMorphItems.entries()) {
+ if (!newNavigationStack.some((item) => item.pageId === pageId)) {
+ set(
+ activeTabIdComponentState.atomFamily({
+ instanceId: getShowPageTabListComponentId({
+ pageId,
+ targetObjectId: morphItem.recordId,
+ }),
+ }),
+ null,
);
}
+ }
- set(commandMenuPageState, newNavigationStackItem.page);
- set(commandMenuPageInfoState, {
- title: newNavigationStackItem.pageTitle,
- Icon: newNavigationStackItem.pageIcon,
- instanceId: newNavigationStackItem.pageId,
- });
- const currentMorphItems = snapshot
- .getLoadable(commandMenuNavigationMorphItemByPageState)
- .getValue();
+ const newMorphItems = new Map(
+ Array.from(currentMorphItems.entries()).filter(([pageId]) =>
+ newNavigationStack.some((item) => item.pageId === pageId),
+ ),
+ );
- for (const [pageId, morphItem] of currentMorphItems.entries()) {
- if (!newNavigationStack.some((item) => item.pageId === pageId)) {
- set(
- activeTabIdComponentState.atomFamily({
- instanceId: getShowPageTabListComponentId({
- pageId,
- targetObjectId: morphItem.recordId,
- }),
- }),
- null,
- );
- }
- }
+ set(commandMenuNavigationMorphItemByPageState, newMorphItems);
- const newMorphItems = new Map(
- Array.from(currentMorphItems.entries()).filter(([pageId]) =>
- newNavigationStack.some((item) => item.pageId === pageId),
- ),
- );
-
- set(commandMenuNavigationMorphItemByPageState, newMorphItems);
-
- set(hasUserSelectedCommandState, false);
-
- setHotkeyScope(CommandMenuHotkeyScope.CommandMenuFocused, {
- commandMenuOpen: true,
- });
- };
- },
- [setHotkeyScope],
- );
+ set(hasUserSelectedCommandState, false);
+ };
+ }, []);
return {
goBackFromCommandMenu,
diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts
index 9f019dab0..2ae936f69 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts
+++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts
@@ -1,16 +1,16 @@
import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId';
+import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { useCommandMenuHistory } from '@/command-menu/hooks/useCommandMenuHistory';
import { useOpenRecordsSearchPageInCommandMenu } from '@/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu';
import { useSetGlobalCommandMenuContext } from '@/command-menu/hooks/useSetGlobalCommandMenuContext';
import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState';
import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState';
-import { CommandMenuHotkeyScope } from '@/command-menu/types/CommandMenuHotkeyScope';
import { CommandMenuPages } from '@/command-menu/types/CommandMenuPages';
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu';
import { useGlobalHotkeys } from '@/ui/utilities/hotkey/hooks/useGlobalHotkeys';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
+import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { isNonEmptyString } from '@sniptt/guards';
import { useRecoilValue } from 'recoil';
@@ -43,7 +43,6 @@ export const useCommandMenuHotKeys = () => {
toggleCommandMenu();
},
true,
- AppHotkeyScope.CommandMenu,
[closeKeyboardShortcutMenu, toggleCommandMenu],
);
@@ -53,26 +52,24 @@ export const useCommandMenuHotKeys = () => {
openRecordsSearchPage();
},
false,
- AppHotkeyScope.SearchRecords,
[openRecordsSearchPage],
{
ignoreModifiers: true,
},
);
- useGlobalHotkeys(
- [Key.Escape],
- () => {
+ useHotkeysOnFocusedElement({
+ keys: [Key.Escape],
+ callback: () => {
goBackFromCommandMenu();
},
- true,
- CommandMenuHotkeyScope.CommandMenuFocused,
- [goBackFromCommandMenu],
- );
+ focusId: SIDE_PANEL_FOCUS_ID,
+ dependencies: [goBackFromCommandMenu],
+ });
- useGlobalHotkeys(
- [Key.Backspace, Key.Delete],
- () => {
+ useHotkeysOnFocusedElement({
+ keys: [Key.Backspace, Key.Delete],
+ callback: () => {
if (isNonEmptyString(commandMenuSearch)) {
return;
}
@@ -91,17 +88,13 @@ export const useCommandMenuHotKeys = () => {
goBackFromCommandMenu();
}
},
- true,
- CommandMenuHotkeyScope.CommandMenuFocused,
- [
+ focusId: SIDE_PANEL_FOCUS_ID,
+ dependencies: [
commandMenuPage,
commandMenuSearch,
contextStoreTargetedRecordsRuleComponent,
goBackFromCommandMenu,
setGlobalCommandMenuContext,
],
- {
- preventDefault: false,
- },
- );
+ });
};
diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useNavigateCommandMenu.ts b/packages/twenty-front/src/modules/command-menu/hooks/useNavigateCommandMenu.ts
index fea324c5c..9aa7c5e28 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/useNavigateCommandMenu.ts
+++ b/packages/twenty-front/src/modules/command-menu/hooks/useNavigateCommandMenu.ts
@@ -10,7 +10,6 @@ import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState
import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState';
import { isCommandMenuClosingState } from '@/command-menu/states/isCommandMenuClosingState';
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
-import { CommandMenuHotkeyScope } from '@/command-menu/types/CommandMenuHotkeyScope';
import { CommandMenuPages } from '@/command-menu/types/CommandMenuPages';
import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';
import { isDragSelectionStartEnabledState } from '@/ui/utilities/drag-select/states/internal/isDragSelectionStartEnabledState';
@@ -61,13 +60,9 @@ export const useNavigateCommandMenu = () => {
type: FocusComponentType.SIDE_PANEL,
instanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID,
},
- hotkeyScope: {
- scope: CommandMenuHotkeyScope.CommandMenuFocused,
- customScopes: {
- commandMenuOpen: true,
- },
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: COMMAND_MENU_COMPONENT_INSTANCE_ID,
});
copyContextStoreStates({
diff --git a/packages/twenty-front/src/modules/command-menu/types/CommandMenuHotkeyScope.ts b/packages/twenty-front/src/modules/command-menu/types/CommandMenuHotkeyScope.ts
deleted file mode 100644
index 55f742a98..000000000
--- a/packages/twenty-front/src/modules/command-menu/types/CommandMenuHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum CommandMenuHotkeyScope {
- CommandMenuFocused = 'command-menu-focused',
-}
diff --git a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx
index 80963dad1..f2731d522 100644
--- a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx
+++ b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx
@@ -159,7 +159,6 @@ export const CurrentWorkspaceMemberFavorites = ({
onSubmit={handleSubmitRename}
onCancel={handleCancelRename}
onClickOutside={handleClickOutside}
- hotkeyScope="favorites-folder-input"
/>
) : (
diff --git a/packages/twenty-front/src/modules/favorites/components/FavoritesFolders.tsx b/packages/twenty-front/src/modules/favorites/components/FavoritesFolders.tsx
index 939d7972e..2cb84bdd8 100644
--- a/packages/twenty-front/src/modules/favorites/components/FavoritesFolders.tsx
+++ b/packages/twenty-front/src/modules/favorites/components/FavoritesFolders.tsx
@@ -1,5 +1,4 @@
import { CurrentWorkspaceMemberFavorites } from '@/favorites/components/CurrentWorkspaceMemberFavorites';
-import { FavoriteFolderHotkeyScope } from '@/favorites/constants/FavoriteFolderRightIconDropdownHotkeyScope';
import { useCreateFavoriteFolder } from '@/favorites/hooks/useCreateFavoriteFolder';
import { useFavoritesByFolder } from '@/favorites/hooks/useFavoritesByFolder';
import { isFavoriteFolderCreatingState } from '@/favorites/states/isFavoriteFolderCreatingState';
@@ -71,9 +70,6 @@ export const FavoriteFolders = ({
onSubmit={handleSubmitFavoriteFolderCreation}
onCancel={handleCancelFavoriteFolderCreation}
onClickOutside={handleClickOutside}
- hotkeyScope={
- FavoriteFolderHotkeyScope.FavoriteFolderNavigationInput
- }
/>
)}
diff --git a/packages/twenty-front/src/modules/favorites/constants/FavoriteFolderRightIconDropdownHotkeyScope.ts b/packages/twenty-front/src/modules/favorites/constants/FavoriteFolderRightIconDropdownHotkeyScope.ts
deleted file mode 100644
index b2b4f81f6..000000000
--- a/packages/twenty-front/src/modules/favorites/constants/FavoriteFolderRightIconDropdownHotkeyScope.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export enum FavoriteFolderHotkeyScope {
- FavoriteFolderRightIconDropdown = 'favorite-folder-right-icon-dropdown',
- FavoriteFolderNavigationInput = 'favorite-folder-navigation-input',
-}
diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPicker.tsx b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPicker.tsx
index 0f5c5bf14..0e42341e8 100644
--- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPicker.tsx
+++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPicker.tsx
@@ -9,7 +9,6 @@ import { ObjectRecord } from '@/object-record/types/ObjectRecord';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
@@ -68,7 +67,6 @@ export const FavoriteFolderPicker = ({
onSubmit?.();
},
focusId: dropdownId,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [onSubmit, isFavoriteFolderCreating],
});
@@ -88,7 +86,6 @@ export const FavoriteFolderPicker = ({
}
},
focusId: instanceId,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [
filteredFolders,
showNoFolderOption,
diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx
index bcdbbb4e5..a6463df60 100644
--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx
+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx
@@ -1,7 +1,6 @@
import { useRecoilValue } from 'recoil';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { useKeyboardShortcutMenu } from '../hooks/useKeyboardShortcutMenu';
import { isKeyboardShortcutMenuOpenedState } from '../states/isKeyboardShortcutMenuOpenedState';
@@ -23,7 +22,6 @@ export const KeyboardShortcutMenu = () => {
toggleKeyboardShortcutMenu();
},
true,
- AppHotkeyScope.KeyboardShortcutMenu,
[toggleKeyboardShortcutMenu],
);
diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent.tsx
index 720a85339..19170d3a6 100644
--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent.tsx
+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent.tsx
@@ -2,7 +2,6 @@ import { Key } from 'ts-key-enum';
import { KEYBOARD_SHORTCUTS_GENERAL } from '@/keyboard-shortcut-menu/constants/KeyboardShortcutsGeneral';
import { KEYBOARD_SHORTCUTS_TABLE } from '@/keyboard-shortcut-menu/constants/KeyboardShortcutsTable';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import {
KEYBOARD_SHORTCUT_MENU_INSTANCE_ID,
@@ -24,7 +23,6 @@ export const KeyboardShortcutMenuOpenContent = () => {
closeKeyboardShortcutMenu();
},
focusId: KEYBOARD_SHORTCUT_MENU_INSTANCE_ID,
- scope: AppHotkeyScope.KeyboardShortcutMenuOpen,
dependencies: [closeKeyboardShortcutMenu],
});
diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/__tests__/useKeyboardShortcutMenu.test.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/__tests__/useKeyboardShortcutMenu.test.tsx
index 082d04df8..d6e7bfe95 100644
--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/__tests__/useKeyboardShortcutMenu.test.tsx
+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/__tests__/useKeyboardShortcutMenu.test.tsx
@@ -4,7 +4,6 @@ import { act } from 'react';
import { RecoilRoot, useRecoilValue } from 'recoil';
import { isKeyboardShortcutMenuOpenedState } from '@/keyboard-shortcut-menu/states/isKeyboardShortcutMenuOpenedState';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { useKeyboardShortcutMenu } from '../useKeyboardShortcutMenu';
@@ -68,9 +67,6 @@ describe('useKeyboardShortcutMenu', () => {
enableGlobalHotkeysConflictingWithKeyboard: false,
enableGlobalHotkeysWithModifiers: false,
},
- hotkeyScope: {
- scope: AppHotkeyScope.KeyboardShortcutMenuOpen,
- },
});
expect(result.current.isKeyboardShortcutMenuOpened).toBe(true);
@@ -100,9 +96,6 @@ describe('useKeyboardShortcutMenu', () => {
enableGlobalHotkeysConflictingWithKeyboard: false,
enableGlobalHotkeysWithModifiers: false,
},
- hotkeyScope: {
- scope: AppHotkeyScope.KeyboardShortcutMenuOpen,
- },
});
expect(result.current.isKeyboardShortcutMenuOpened).toBe(true);
diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu.ts b/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu.ts
index 91e32dfb0..b7fa6a5f4 100644
--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu.ts
+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu.ts
@@ -1,7 +1,5 @@
import { useRecoilCallback } from 'recoil';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
-
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -28,9 +26,6 @@ export const useKeyboardShortcutMenu = () => {
enableGlobalHotkeysConflictingWithKeyboard: false,
enableGlobalHotkeysWithModifiers: false,
},
- hotkeyScope: {
- scope: AppHotkeyScope.KeyboardShortcutMenuOpen,
- },
});
},
[pushFocusItemToFocusStack],
diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx
index a61953b78..8691fb835 100644
--- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx
+++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx
@@ -23,7 +23,6 @@ import { isCompositeFieldType } from '@/object-record/object-filter-dropdown/uti
import { useFilterableFieldMetadataItemsInRecordIndexContext } from '@/object-record/record-filter/hooks/useFilterableFieldMetadataItemsInRecordIndexContext';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuSectionLabel } from '@/ui/layout/dropdown/components/DropdownMenuSectionLabel';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
@@ -148,7 +147,6 @@ export const AdvancedFilterFieldSelectMenu = ({
focusId={advancedFilterFieldSelectDropdownId}
selectableItemIdArray={selectableItemIdArray}
selectableListInstanceId={advancedFilterFieldSelectDropdownId}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{shouldShowVisibleFields && (
<>
diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelectContent.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelectContent.tsx
index dcdc18da8..5651ee818 100644
--- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelectContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelectContent.tsx
@@ -8,7 +8,6 @@ import { SelectControl } from '@/ui/input/components/SelectControl';
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
@@ -69,7 +68,6 @@ export const AdvancedFilterRecordFilterOperandSelectContent = ({
(operand) => operand,
)}
selectableListInstanceId={dropdownId}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{operandsForFilterType.map((filterOperand, index) => (
{compositeFieldTypeIsFilterableByAnySubField && (
{
type: FocusComponentType.DROPDOWN,
instanceId: fieldMetadataItem.id,
},
- hotkeyScope: {
- scope: DropdownHotkeyScope.Dropdown,
- },
- memoizeKey: fieldMetadataItem.id,
});
}
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownBooleanSelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownBooleanSelect.tsx
index b579d66a4..7a6e2443e 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownBooleanSelect.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownBooleanSelect.tsx
@@ -6,7 +6,6 @@ import { useObjectFilterDropdownFilterValue } from '@/object-record/object-filte
import { BooleanDisplay } from '@/ui/field/display/components/BooleanDisplay';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
@@ -58,7 +57,6 @@ export const ObjectFilterDropdownBooleanSelect = () => {
selectableListInstanceId="boolean-select"
selectableItemIdArray={options.map((option) => option.toString())}
focusId="boolean-select"
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{options.map((option) => (
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownOptionSelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownOptionSelect.tsx
index 2f181563a..02cf50f75 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownOptionSelect.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownOptionSelect.tsx
@@ -13,7 +13,6 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/ob
import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector';
import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState';
import { objectFilterDropdownSearchInputComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
@@ -103,7 +102,6 @@ export const ObjectFilterDropdownOptionSelect = ({
resetSelectedItem();
},
focusId,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [closeDropdown, resetSelectedItem],
});
@@ -154,7 +152,6 @@ export const ObjectFilterDropdownOptionSelect = ({
selectableListInstanceId={componentInstanceId}
selectableItemIdArray={objectRecordsIds}
focusId={focusId}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{showNoResult ? (
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx
index 7dcd4efaf..0fdcabe94 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx
@@ -9,7 +9,6 @@ import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenu
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
@@ -110,7 +109,6 @@ export const ObjectOptionsDropdownLayoutContent = () => {
selectableListInstanceId={OBJECT_OPTIONS_DROPDOWN_ID}
focusId={OBJECT_OPTIONS_DROPDOWN_ID}
selectableItemIdArray={selectableItemIdArray}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{
selectableListInstanceId={OBJECT_OPTIONS_DROPDOWN_ID}
focusId={OBJECT_OPTIONS_DROPDOWN_ID}
selectableItemIdArray={selectableItemIdArray}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{
selectableListInstanceId={OBJECT_OPTIONS_DROPDOWN_ID}
focusId={OBJECT_OPTIONS_DROPDOWN_ID}
selectableItemIdArray={selectableItemIdArray}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{
selectableListInstanceId={OBJECT_OPTIONS_DROPDOWN_ID}
focusId={OBJECT_OPTIONS_DROPDOWN_ID}
selectableItemIdArray={selectableItemIdArray}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{
selectableListInstanceId={OBJECT_OPTIONS_DROPDOWN_ID}
focusId={OBJECT_OPTIONS_DROPDOWN_ID}
selectableItemIdArray={selectableItemIdArray}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{currentView?.key !== 'INDEX' && (
<>
@@ -181,7 +179,6 @@ export const ObjectOptionsDropdownRecordGroupsContent = () => {
selectableListInstanceId={hiddenGroupsSelectableListId}
focusId={hiddenGroupsSelectableListId}
selectableItemIdArray={['HiddenGroups']}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{
const { resetRecordSortDropdownSearchInput } =
useResetRecordSortDropdownSearchInput();
@@ -237,7 +231,6 @@ export const ObjectSortDropdownButton = () => {
selectableListInstanceId={OBJECT_SORT_DROPDOWN_ID}
selectableItemIdArray={selectableItemIdArray}
focusId={OBJECT_SORT_DROPDOWN_ID}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{isRecordSortDirectionMenuUnfolded && (
diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardBodyEscapeHotkeyEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardBodyEscapeHotkeyEffect.tsx
index 8ea830af3..5fee55e10 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardBodyEscapeHotkeyEffect.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardBodyEscapeHotkeyEffect.tsx
@@ -6,7 +6,7 @@ import { useFocusedRecordBoardCard } from '@/object-record/record-board/hooks/us
import { useRecordBoardSelection } from '@/object-record/record-board/hooks/useRecordBoardSelection';
import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector';
import { useResetFocusStackToRecordIndex } from '@/object-record/record-index/hooks/useResetFocusStackToRecordIndex';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
+import { PageFocusId } from '@/types/PageFocusId';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
@@ -35,8 +35,7 @@ export const RecordBoardBodyEscapeHotkeyEffect = () => {
useHotkeysOnFocusedElement({
keys: [Key.Escape],
callback: handleEscape,
- focusId: recordBoardId,
- scope: RecordIndexHotkeyScope.RecordIndex,
+ focusId: PageFocusId.RecordIndex,
dependencies: [handleEscape],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardHotkeyEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardHotkeyEffect.tsx
index d6527743a..021118c01 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardHotkeyEffect.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardHotkeyEffect.tsx
@@ -4,7 +4,6 @@ import { Key } from 'ts-key-enum';
import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext';
import { useRecordBoardCardNavigation } from '@/object-record/record-board/hooks/useRecordBoardCardNavigation';
import { useRecordBoardSelectAllHotkeys } from '@/object-record/record-board/hooks/useRecordBoardSelectAllHotkeys';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { PageFocusId } from '@/types/PageFocusId';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
@@ -19,13 +18,12 @@ export const RecordBoardHotkeyEffect = () => {
move('down');
},
focusId: PageFocusId.RecordIndex,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [move],
});
useRecordBoardSelectAllHotkeys({
recordBoardId,
- focusId: recordBoardId,
+ focusId: PageFocusId.RecordIndex,
});
return null;
diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useFocusedRecordBoardCard.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useFocusedRecordBoardCard.ts
index 5a0fff050..961a7701a 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useFocusedRecordBoardCard.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useFocusedRecordBoardCard.ts
@@ -3,7 +3,6 @@ import { focusedRecordBoardCardIndexesComponentState } from '@/object-record/rec
import { isRecordBoardCardFocusActiveComponentState } from '@/object-record/record-board/states/isRecordBoardCardFocusActiveComponentState';
import { isRecordBoardCardFocusedComponentFamilyState } from '@/object-record/record-board/states/isRecordBoardCardFocusedComponentFamilyState';
import { BoardCardIndexes } from '@/object-record/record-board/types/BoardCardIndexes';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -100,15 +99,6 @@ export const useFocusedRecordBoardCard = (recordBoardId?: string) => {
type: FocusComponentType.RECORD_BOARD_CARD,
instanceId: focusId,
},
- hotkeyScope: {
- scope: RecordIndexHotkeyScope.RecordIndex,
- customScopes: {
- goto: true,
- keyboardShortcutMenu: true,
- searchRecords: true,
- },
- },
- memoizeKey: focusId,
});
set(focusedBoardCardIndexesState, boardCardIndexes);
diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardArrowKeysEffect.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardArrowKeysEffect.ts
index 4ab03437d..c99172d9f 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardArrowKeysEffect.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardArrowKeysEffect.ts
@@ -1,5 +1,4 @@
import { useRecordBoardCardNavigation } from '@/object-record/record-board/hooks/useRecordBoardCardNavigation';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { Key } from 'ts-key-enum';
@@ -16,7 +15,6 @@ export const useRecordBoardArrowKeysEffect = ({
keys: [Key.ArrowLeft],
callback: () => move('left'),
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [move],
});
@@ -24,7 +22,6 @@ export const useRecordBoardArrowKeysEffect = ({
keys: [Key.ArrowRight],
callback: () => move('right'),
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [move],
});
@@ -32,7 +29,6 @@ export const useRecordBoardArrowKeysEffect = ({
keys: [Key.ArrowUp],
callback: () => move('up'),
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [move],
});
@@ -40,7 +36,6 @@ export const useRecordBoardArrowKeysEffect = ({
keys: [Key.ArrowDown],
callback: () => move('down'),
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [move],
});
};
diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts
index 23b95d499..6b27006d5 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts
@@ -2,11 +2,11 @@ import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordIn
import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext';
import { useActiveRecordBoardCard } from '@/object-record/record-board/hooks/useActiveRecordBoardCard';
import { useFocusedRecordBoardCard } from '@/object-record/record-board/hooks/useFocusedRecordBoardCard';
+import { useRecordBoardSelectAllHotkeys } from '@/object-record/record-board/hooks/useRecordBoardSelectAllHotkeys';
import { useRecordBoardSelection } from '@/object-record/record-board/hooks/useRecordBoardSelection';
import { RecordBoardCardContext } from '@/object-record/record-board/record-board-card/contexts/RecordBoardCardContext';
import { isRecordBoardCardSelectedComponentFamilyState } from '@/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState';
import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentFamilyValueV2';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
@@ -65,7 +65,6 @@ export const useRecordBoardCardHotkeys = (focusId: string) => {
keys: ['x'],
callback: handleSelectCard,
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleSelectCard],
});
@@ -77,7 +76,6 @@ export const useRecordBoardCardHotkeys = (focusId: string) => {
],
callback: handleOpenRecordInCommandMenu,
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleOpenRecordInCommandMenu],
});
@@ -85,7 +83,11 @@ export const useRecordBoardCardHotkeys = (focusId: string) => {
keys: [Key.Escape],
callback: handleEscape,
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleEscape],
});
+
+ useRecordBoardSelectAllHotkeys({
+ recordBoardId,
+ focusId,
+ });
};
diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardSelectAllHotkeys.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardSelectAllHotkeys.ts
index d4b926d7d..793a047ed 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardSelectAllHotkeys.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardSelectAllHotkeys.ts
@@ -1,10 +1,5 @@
-import { useRecordBoardSelection } from '@/object-record/record-board/hooks/useRecordBoardSelection';
-import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
+import { useSelectAllCards } from '@/object-record/record-board/hooks/useSelectAllCards';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
-import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
-import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
-import { useRecoilCallback } from 'recoil';
export const useRecordBoardSelectAllHotkeys = ({
recordBoardId,
@@ -13,33 +8,13 @@ export const useRecordBoardSelectAllHotkeys = ({
recordBoardId: string;
focusId: string;
}) => {
- const recordIndexAllRecordIdsState = useRecoilComponentCallbackStateV2(
- recordIndexAllRecordIdsComponentSelector,
- );
-
- const { setRecordAsSelected } = useRecordBoardSelection(recordBoardId);
-
- const selectAll = useRecoilCallback(
- ({ snapshot }) =>
- () => {
- const allRecordIds = getSnapshotValue(
- snapshot,
- recordIndexAllRecordIdsState,
- );
-
- for (const recordId of allRecordIds) {
- setRecordAsSelected(recordId, true);
- }
- },
- [recordIndexAllRecordIdsState, setRecordAsSelected],
- );
+ const { selectAllCards } = useSelectAllCards(recordBoardId);
useHotkeysOnFocusedElement({
keys: ['ctrl+a', 'meta+a'],
- callback: selectAll,
+ callback: selectAllCards,
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
- dependencies: [selectAll],
+ dependencies: [selectAllCards],
options: {
enableOnFormTags: false,
},
diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useSelectAllCards.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useSelectAllCards.ts
new file mode 100644
index 000000000..7e7c380a2
--- /dev/null
+++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useSelectAllCards.ts
@@ -0,0 +1,63 @@
+import { useRecoilCallback } from 'recoil';
+
+import { useRecordBoardSelection } from '@/object-record/record-board/hooks/useRecordBoardSelection';
+import { isRecordBoardCardSelectedComponentFamilyState } from '@/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState';
+import { allCardsSelectedStatusComponentSelector } from '@/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector';
+import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector';
+import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
+import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
+
+export const useSelectAllCards = (recordBoardId?: string) => {
+ const allCardsSelectedStatusSelector = useRecoilComponentCallbackStateV2(
+ allCardsSelectedStatusComponentSelector,
+ recordBoardId,
+ );
+ const isRecordBoardCardSelectedFamilyState =
+ useRecoilComponentCallbackStateV2(
+ isRecordBoardCardSelectedComponentFamilyState,
+ recordBoardId,
+ );
+ const recordIndexAllRecordIdsSelector = useRecoilComponentCallbackStateV2(
+ recordIndexAllRecordIdsComponentSelector,
+ recordBoardId,
+ );
+
+ const { resetRecordSelection } = useRecordBoardSelection(recordBoardId);
+
+ const selectAllCards = useRecoilCallback(
+ ({ set, snapshot }) =>
+ () => {
+ const allCardsSelectedStatus = getSnapshotValue(
+ snapshot,
+ allCardsSelectedStatusSelector,
+ );
+
+ const allRecordIds = getSnapshotValue(
+ snapshot,
+ recordIndexAllRecordIdsSelector,
+ );
+
+ if (allCardsSelectedStatus === 'all') {
+ resetRecordSelection();
+ }
+
+ for (const recordId of allRecordIds) {
+ const isSelected =
+ allCardsSelectedStatus === 'none' ||
+ allCardsSelectedStatus === 'some';
+
+ set(isRecordBoardCardSelectedFamilyState(recordId), isSelected);
+ }
+ },
+ [
+ allCardsSelectedStatusSelector,
+ recordIndexAllRecordIdsSelector,
+ resetRecordSelection,
+ isRecordBoardCardSelectedFamilyState,
+ ],
+ );
+
+ return {
+ selectAllCards,
+ };
+};
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector.ts
new file mode 100644
index 000000000..b4957811d
--- /dev/null
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector.ts
@@ -0,0 +1,37 @@
+import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext';
+import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector';
+import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector';
+import { AllRowsSelectedStatus } from '@/object-record/record-table/types/AllRowSelectedStatus';
+import { createComponentSelectorV2 } from '@/ui/utilities/state/component-state/utils/createComponentSelectorV2';
+
+export const allCardsSelectedStatusComponentSelector =
+ createComponentSelectorV2({
+ key: 'allCardsSelectedStatusComponentSelector',
+ componentInstanceContext: RecordBoardComponentInstanceContext,
+ get:
+ ({ instanceId }) =>
+ ({ get }) => {
+ const allRecordIds = get(
+ recordIndexAllRecordIdsComponentSelector.selectorFamily({
+ instanceId,
+ }),
+ );
+
+ const selectedRecordIds = get(
+ recordBoardSelectedRecordIdsComponentSelector.selectorFamily({
+ instanceId,
+ }),
+ );
+
+ const numberOfSelectedCards = selectedRecordIds.length;
+
+ const allCardsSelectedStatus =
+ numberOfSelectedCards === 0
+ ? 'none'
+ : selectedRecordIds.length === allRecordIds.length
+ ? 'all'
+ : 'some';
+
+ return allCardsSelectedStatus;
+ },
+ });
diff --git a/packages/twenty-front/src/modules/object-record/record-board/types/BoardColumnHotkeyScope.ts b/packages/twenty-front/src/modules/object-record/record-board/types/BoardColumnHotkeyScope.ts
deleted file mode 100644
index abb33cec1..000000000
--- a/packages/twenty-front/src/modules/object-record/record-board/types/BoardColumnHotkeyScope.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export enum RecordBoardColumnHotkeyScope {
- BoardColumn = 'board-column',
- ColumnHeader = 'column-header',
-}
diff --git a/packages/twenty-front/src/modules/object-record/record-board/types/BoardHotkeyScope.ts b/packages/twenty-front/src/modules/object-record/record-board/types/BoardHotkeyScope.ts
deleted file mode 100644
index b58840d74..000000000
--- a/packages/twenty-front/src/modules/object-record/record-board/types/BoardHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum BoardHotkeyScope {
- BoardFocus = 'board-focus',
-}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx
index 4bccfac14..80e6de876 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx
@@ -14,11 +14,13 @@ import { MIN_DATE } from '@/ui/input/components/internal/date/constants/MinDate'
import { useDateParser } from '@/ui/input/components/internal/hooks/useDateParser';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { OverlayContainer } from '@/ui/layout/overlay/components/OverlayContainer';
+import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { isStandaloneVariableString } from '@/workflow/utils/isStandaloneVariableString';
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { ChangeEvent, KeyboardEvent, useId, useRef, useState } from 'react';
+import { Key } from 'ts-key-enum';
import { isDefined } from 'twenty-shared/utils';
import { TEXT_INPUT_STYLE } from 'twenty-ui/theme';
import { Nullable } from 'twenty-ui/utilities';
@@ -290,6 +292,13 @@ export const FormDateTimeFieldInput = ({
onChange(null);
};
+ useHotkeysOnFocusedElement({
+ keys: [Key.Escape],
+ callback: handlePickerEscape,
+ focusId: instanceId,
+ dependencies: [handlePickerEscape],
+ });
+
return (
{label ? {label} : null}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormFieldInputInnerContainer.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormFieldInputInnerContainer.tsx
index 5d97d4889..f04f53ae0 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormFieldInputInnerContainer.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormFieldInputInnerContainer.tsx
@@ -1,4 +1,3 @@
-import { FormFieldInputHotKeyScope } from '@/object-record/record-field/form-types/constants/FormFieldInputHotKeyScope';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -10,7 +9,7 @@ type FormFieldInputInnerContainerProps = {
hasRightElement: boolean;
multiline?: boolean;
readonly?: boolean;
- preventSetHotkeyScope?: boolean;
+ preventFocusStackUpdate?: boolean;
formFieldInputInstanceId: string;
};
@@ -51,7 +50,7 @@ export const FormFieldInputInnerContainer = forwardRef(
hasRightElement,
multiline,
readonly,
- preventSetHotkeyScope = false,
+ preventFocusStackUpdate = false,
onClick,
formFieldInputInstanceId,
}: HTMLAttributes & FormFieldInputInnerContainerProps,
@@ -64,14 +63,16 @@ export const FormFieldInputInnerContainer = forwardRef(
const handleFocus = (e: React.FocusEvent) => {
onFocus?.(e);
- if (!preventSetHotkeyScope) {
+ if (!preventFocusStackUpdate) {
pushFocusItemToFocusStack({
focusId: formFieldInputInstanceId,
component: {
type: FocusComponentType.FORM_FIELD_INPUT,
instanceId: formFieldInputInstanceId,
},
- hotkeyScope: { scope: FormFieldInputHotKeyScope.FormFieldInput },
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
+ },
});
}
};
@@ -79,7 +80,7 @@ export const FormFieldInputInnerContainer = forwardRef(
const handleBlur = (e: React.FocusEvent) => {
onBlur?.(e);
- if (!preventSetHotkeyScope) {
+ if (!preventFocusStackUpdate) {
removeFocusItemFromFocusStackById({
focusId: formFieldInputInstanceId,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormMultiSelectFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormMultiSelectFieldInput.tsx
index 8533e333c..20931398e 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormMultiSelectFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormMultiSelectFieldInput.tsx
@@ -5,7 +5,6 @@ import { FormFieldInputInnerContainer } from '@/object-record/record-field/form-
import { FormFieldInputRowContainer } from '@/object-record/record-field/form-types/components/FormFieldInputRowContainer';
import { FormFieldPlaceholder } from '@/object-record/record-field/form-types/components/FormFieldPlaceholder';
import { VariableChipStandalone } from '@/object-record/record-field/form-types/components/VariableChipStandalone';
-import { FormMultiSelectFieldInputHotKeyScope } from '@/object-record/record-field/form-types/constants/FormMultiSelectFieldInputHotKeyScope';
import { VariablePickerComponent } from '@/object-record/record-field/form-types/types/VariablePickerComponent';
import { SELECT_FIELD_INPUT_SELECTABLE_LIST_COMPONENT_INSTANCE_ID } from '@/object-record/record-field/meta-types/input/constants/SelectFieldInputSelectableListComponentInstanceId';
import { FieldMultiSelectValue } from '@/object-record/record-field/types/FieldMetadata';
@@ -87,9 +86,6 @@ export const FormMultiSelectFieldInput = ({
const instanceId = useId();
const theme = useTheme();
- const hotkeyScope =
- FormMultiSelectFieldInputHotKeyScope.FormMultiSelectFieldInput;
-
const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();
const { removeFocusItemFromFocusStackById } =
useRemoveFocusItemFromFocusStackById();
@@ -135,7 +131,9 @@ export const FormMultiSelectFieldInput = ({
type: FocusComponentType.FORM_FIELD_INPUT,
instanceId,
},
- hotkeyScope: { scope: hotkeyScope },
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
+ },
});
};
@@ -262,7 +260,7 @@ export const FormMultiSelectFieldInput = ({
selectableListComponentInstanceId={
SELECT_FIELD_INPUT_SELECTABLE_LIST_COMPONENT_INSTANCE_ID
}
- focusId={hotkeyScope}
+ focusId={instanceId}
options={options}
onCancel={onCancel}
onOptionSelected={onOptionSelected}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx
index f78467a32..1c1282773 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx
@@ -135,7 +135,6 @@ export const FormNumberFieldInput = ({
}
value={draftValue.value}
copyButton={false}
- hotkeyScope="record-create"
onChange={handleChange}
disabled={readonly}
/>
diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx
index 3da6cefa6..c1a629ba5 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx
@@ -3,7 +3,6 @@ import { FormFieldInputInnerContainer } from '@/object-record/record-field/form-
import { FormFieldInputRowContainer } from '@/object-record/record-field/form-types/components/FormFieldInputRowContainer';
import { VariableChipStandalone } from '@/object-record/record-field/form-types/components/VariableChipStandalone';
import { VariablePickerComponent } from '@/object-record/record-field/form-types/types/VariablePickerComponent';
-import { InlineCellHotkeyScope } from '@/object-record/record-inline-cell/types/InlineCellHotkeyScope';
import { InputLabel } from '@/ui/input/components/InputLabel';
import { Select } from '@/ui/input/components/Select';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
@@ -38,8 +37,6 @@ export const FormSelectFieldInput = ({
const instanceId = useId();
- const hotkeyScope = InlineCellHotkeyScope.InlineCell;
-
const { removeFocusItemFromFocusStackById } =
useRemoveFocusItemFromFocusStackById();
@@ -124,7 +121,6 @@ export const FormSelectFieldInput = ({
keys: Key.Escape,
callback: onCancel,
focusId: instanceId,
- scope: hotkeyScope,
dependencies: [onCancel],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSingleRecordPicker.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSingleRecordPicker.tsx
index accf3cfd7..7561ccdf7 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSingleRecordPicker.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSingleRecordPicker.tsx
@@ -175,7 +175,7 @@ export const FormSingleRecordPicker = ({
diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/constants/FormFieldInputHotKeyScope.ts b/packages/twenty-front/src/modules/object-record/record-field/form-types/constants/FormFieldInputHotKeyScope.ts
deleted file mode 100644
index 38c1c948c..000000000
--- a/packages/twenty-front/src/modules/object-record/record-field/form-types/constants/FormFieldInputHotKeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum FormFieldInputHotKeyScope {
- FormFieldInput = 'form-field-input',
-}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/constants/FormMultiSelectFieldInputHotKeyScope.ts b/packages/twenty-front/src/modules/object-record/record-field/form-types/constants/FormMultiSelectFieldInputHotKeyScope.ts
deleted file mode 100644
index fa533007d..000000000
--- a/packages/twenty-front/src/modules/object-record/record-field/form-types/constants/FormMultiSelectFieldInputHotKeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum FormMultiSelectFieldInputHotKeyScope {
- FormMultiSelectFieldInput = 'form-multi-select-field-input',
-}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useOpenFieldInputEditMode.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useOpenFieldInputEditMode.ts
index 3a24a310c..465d6a884 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useOpenFieldInputEditMode.ts
+++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useOpenFieldInputEditMode.ts
@@ -15,10 +15,8 @@ import {
} from '@/object-record/record-field/types/FieldMetadata';
import { isFieldRelationFromManyObjects } from '@/object-record/record-field/types/guards/isFieldRelationFromManyObjects';
import { isFieldRelationToOneObject } from '@/object-record/record-field/types/guards/isFieldRelationToOneObject';
-import { INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY } from '@/object-record/record-inline-cell/constants/InlineCellHotkeyScopeMemoizeKey';
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';
@@ -128,11 +126,9 @@ export const useOpenFieldInputEditMode = () => {
prefix,
}),
},
- hotkeyScope: {
- scope: DEFAULT_CELL_SCOPE.scope,
- customScopes: DEFAULT_CELL_SCOPE.customScopes,
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY,
});
},
[
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/AddressFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/AddressFieldInput.tsx
index 10fd74885..6a1975b79 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/AddressFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/AddressFieldInput.tsx
@@ -7,7 +7,6 @@ import {
FieldInputClickOutsideEvent,
FieldInputEvent,
} from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { usePersistField } from '../../../hooks/usePersistField';
@@ -83,7 +82,6 @@ export const AddressFieldInput = ({
onClickOutside={handleClickOutside}
onEnter={handleEnter}
onEscape={handleEscape}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
onChange={handleChange}
onTab={handleTab}
onShiftTab={handleShiftTab}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/ArrayFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/ArrayFieldInput.tsx
index a0bda908c..288880831 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/ArrayFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/ArrayFieldInput.tsx
@@ -1,7 +1,6 @@
import { useArrayField } from '@/object-record/record-field/meta-types/hooks/useArrayField';
import { ArrayFieldMenuItem } from '@/object-record/record-field/meta-types/input/components/ArrayFieldMenuItem';
import { MultiItemFieldInput } from '@/object-record/record-field/meta-types/input/components/MultiItemFieldInput';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useMemo } from 'react';
import { FieldMetadataType } from '~/generated-metadata/graphql';
@@ -23,7 +22,6 @@ export const ArrayFieldInput = ({
return (
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/DateFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/DateFieldInput.tsx
index 566f72816..173e37f57 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/DateFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/DateFieldInput.tsx
@@ -3,7 +3,6 @@ import { DateInput } from '@/ui/field/input/components/DateInput';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { FieldInputClickOutsideEvent } from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { isDefined } from 'twenty-shared/utils';
import { Nullable } from 'twenty-ui/utilities';
@@ -88,7 +87,6 @@ export const DateFieldInput = ({
onChange={handleChange}
onClear={handleClear}
onSubmit={handleSubmit}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
/>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/DateTimeFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/DateTimeFieldInput.tsx
index e06720f35..ead09e752 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/DateTimeFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/DateTimeFieldInput.tsx
@@ -4,7 +4,6 @@ import { FieldInputEvent } from '@/object-record/record-field/meta-types/input/c
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { FieldInputClickOutsideEvent } from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { Nullable } from 'twenty-ui/utilities';
import { usePersistField } from '../../../hooks/usePersistField';
@@ -84,7 +83,6 @@ export const DateTimeFieldInput = ({
isDateTimeInput
onClear={handleClear}
onSubmit={handleSubmit}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
/>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/EmailsFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/EmailsFieldInput.tsx
index 604a8000f..b7704cdaa 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/EmailsFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/EmailsFieldInput.tsx
@@ -2,7 +2,6 @@ import { useEmailsField } from '@/object-record/record-field/meta-types/hooks/us
import { EmailsFieldMenuItem } from '@/object-record/record-field/meta-types/input/components/EmailsFieldMenuItem';
import { recordFieldInputIsFieldInErrorComponentState } from '@/object-record/record-field/states/recordFieldInputIsFieldInErrorComponentState';
import { emailSchema } from '@/object-record/record-field/validation-schemas/emailSchema';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
import { useCallback, useMemo } from 'react';
import { isDefined } from 'twenty-shared/utils';
@@ -88,7 +87,6 @@ export const EmailsFieldInput = ({
/>
)}
onError={handleError}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
/>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
index 1658ddfbf..a72a52ee4 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
@@ -10,7 +10,6 @@ import {
FieldInputClickOutsideEvent,
FieldInputEvent,
} from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
type FullNameFieldInputProps = {
@@ -101,7 +100,6 @@ export const FullNameFieldInput = ({
onShiftTab={handleShiftTab}
onTab={handleTab}
onPaste={handlePaste}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
onChange={handleChange}
/>
);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/LinksFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/LinksFieldInput.tsx
index 24faf715a..c718bf7e7 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/LinksFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/LinksFieldInput.tsx
@@ -2,7 +2,6 @@ import { useLinksField } from '@/object-record/record-field/meta-types/hooks/use
import { LinksFieldMenuItem } from '@/object-record/record-field/meta-types/input/components/LinksFieldMenuItem';
import { getFieldLinkDefinedLinks } from '@/object-record/record-field/meta-types/input/utils/getFieldLinkDefinedLinks';
import { recordFieldInputIsFieldInErrorComponentState } from '@/object-record/record-field/states/recordFieldInputIsFieldInErrorComponentState';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
import { useMemo } from 'react';
import { absoluteUrlSchema } from 'twenty-shared/utils';
@@ -85,7 +84,6 @@ export const LinksFieldInput = ({
url={link.url}
/>
)}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
/>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/MultiItemBaseInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/MultiItemBaseInput.tsx
index 8cdcbd712..88cec276e 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/MultiItemBaseInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/MultiItemBaseInput.tsx
@@ -67,7 +67,6 @@ const StyledErrorDiv = styled.div`
type HTMLInputProps = InputHTMLAttributes;
export type MultiItemBaseInputProps = Omit & {
- hotkeyScope?: string;
onClickOutside?: () => void;
onEnter?: () => void;
onEscape?: () => void;
@@ -97,7 +96,6 @@ export const MultiItemBaseInput = forwardRef<
className,
value,
placeholder,
- hotkeyScope = 'dropdown-menu-input',
onChange,
onClickOutside,
onEnter = () => {},
@@ -125,7 +123,6 @@ export const MultiItemBaseInput = forwardRef<
onClickOutside,
onTab,
onShiftTab,
- hotkeyScope,
});
return (
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/MultiItemFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/MultiItemFieldInput.tsx
index cac4f19ff..6407d8aea 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/MultiItemFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/MultiItemFieldInput.tsx
@@ -37,7 +37,6 @@ type MultiItemFieldInputProps = {
handleSetPrimary: () => void;
handleDelete: () => void;
}) => React.ReactNode;
- hotkeyScope: string;
newItemLabel?: string;
fieldMetadataType: FieldMetadataType;
renderInput?: MultiItemBaseInputProps['renderInput'];
@@ -55,7 +54,6 @@ export const MultiItemFieldInput = ({
validateInput,
formatInput,
renderItem,
- hotkeyScope,
newItemLabel,
fieldMetadataType,
renderInput,
@@ -67,6 +65,10 @@ export const MultiItemFieldInput = ({
onCancel?.();
};
+ const instanceId = useAvailableComponentInstanceIdOrThrow(
+ RecordFieldComponentInstanceContext,
+ );
+
useListenClickOutside({
refs: [containerRef],
callback: (event) => {
@@ -78,18 +80,13 @@ export const MultiItemFieldInput = ({
}
onClickOutside?.(() => {}, event);
},
- listenerId: hotkeyScope,
+ listenerId: instanceId,
});
- const instanceId = useAvailableComponentInstanceIdOrThrow(
- RecordFieldComponentInstanceContext,
- );
-
useHotkeysOnFocusedElement({
focusId: instanceId,
keys: [Key.Escape],
callback: handleDropdownClose,
- scope: hotkeyScope,
dependencies: [handleDropdownClose],
});
@@ -220,7 +217,6 @@ export const MultiItemFieldInput = ({
autoFocus
placeholder={placeholder}
value={inputValue}
- hotkeyScope={hotkeyScope}
hasError={!errorData.isValid}
renderInput={renderInput}
onEscape={handleDropdownClose}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/NumberFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/NumberFieldInput.tsx
index 11d5be096..c7a999c05 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/NumberFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/NumberFieldInput.tsx
@@ -2,7 +2,6 @@ import { TextInput } from '@/ui/field/input/components/TextInput';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { FieldInputClickOutsideEvent } from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { FieldInputContainer } from '@/ui/field/input/components/FieldInputContainer';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { useNumberField } from '../../hooks/useNumberField';
@@ -70,7 +69,6 @@ export const NumberFieldInput = ({
onEscape={handleEscape}
onShiftTab={handleShiftTab}
onTab={handleTab}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
onChange={handleChange}
/>
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/PhonesFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/PhonesFieldInput.tsx
index 26f0da184..466058def 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/PhonesFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/PhonesFieldInput.tsx
@@ -9,7 +9,6 @@ import { MultiItemFieldInput } from './MultiItemFieldInput';
import { createPhonesFromFieldValue } from '@/object-record/record-field/meta-types/input/utils/phonesUtils';
import { FieldInputClickOutsideEvent } from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { PhoneCountryPickerDropdownButton } from '@/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton';
import { css } from '@emotion/react';
import { TEXT_INPUT_STYLE } from 'twenty-ui/theme';
@@ -155,7 +154,6 @@ export const PhonesFieldInput = ({
);
}}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
/>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RawJsonFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RawJsonFieldInput.tsx
index 68fba461f..3d452b5be 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RawJsonFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RawJsonFieldInput.tsx
@@ -6,7 +6,6 @@ import {
FieldInputClickOutsideEvent,
FieldInputEvent,
} from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
@@ -69,8 +68,6 @@ export const RawJsonFieldInput = ({
fieldDefinition,
} = useJsonField();
- const hotkeyScope = DEFAULT_CELL_SCOPE.scope;
-
const containerRef = useRef(null);
const instanceId = useAvailableComponentInstanceIdOrThrow(
RecordFieldComponentInstanceContext,
@@ -106,7 +103,7 @@ export const RawJsonFieldInput = ({
callback: (event) => {
handleClickOutside(event, draftValue ?? '');
},
- listenerId: hotkeyScope,
+ listenerId: instanceId,
});
useHotkeysOnFocusedElement({
@@ -114,7 +111,6 @@ export const RawJsonFieldInput = ({
callback: () => {
handleEscape(draftValue ?? '');
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [handleEscape, draftValue],
});
@@ -124,7 +120,6 @@ export const RawJsonFieldInput = ({
callback: () => {
handleTab(draftValue ?? '');
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [handleTab, draftValue],
});
@@ -134,7 +129,6 @@ export const RawJsonFieldInput = ({
callback: () => {
handleShiftTab(draftValue ?? '');
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [handleShiftTab, draftValue],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RichTextFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RichTextFieldInput.tsx
index b931841f7..91a723ce5 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RichTextFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RichTextFieldInput.tsx
@@ -8,7 +8,6 @@ import {
FieldInputClickOutsideEvent,
FieldInputEvent,
} from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
@@ -92,7 +91,6 @@ export const RichTextFieldInput = ({
inputValue: null,
onClickOutside: handleClickOutside,
onEscape: handleEscape,
- hotkeyScope: DEFAULT_CELL_SCOPE.scope,
});
return (
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/SelectFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/SelectFieldInput.tsx
index d182ca46c..ed0dfb1e3 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/SelectFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/SelectFieldInput.tsx
@@ -3,7 +3,6 @@ import { useSelectField } from '@/object-record/record-field/meta-types/hooks/us
import { SELECT_FIELD_INPUT_SELECTABLE_LIST_COMPONENT_INSTANCE_ID } from '@/object-record/record-field/meta-types/input/constants/SelectFieldInputSelectableListComponentInstanceId';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { FieldInputEvent } from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { SelectInput } from '@/ui/field/input/components/SelectInput';
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
@@ -56,7 +55,6 @@ export const SelectFieldInput = ({
onCancel?.();
resetSelectedItem();
},
- scope: DEFAULT_CELL_SCOPE.scope,
focusId: instanceId,
dependencies: [onCancel, resetSelectedItem],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/TextFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/TextFieldInput.tsx
index 9b8542a1e..de98d9f19 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/TextFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/TextFieldInput.tsx
@@ -8,7 +8,6 @@ import {
FieldInputClickOutsideEvent,
FieldInputEvent,
} from '@/object-record/record-field/types/FieldInputEvent';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { FieldInputContainer } from '@/ui/field/input/components/FieldInputContainer';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { turnIntoUndefinedIfWhitespacesOnly } from '~/utils/string/turnIntoUndefinedIfWhitespacesOnly';
@@ -74,7 +73,6 @@ export const TextFieldInput = ({
onEscape={handleEscape}
onShiftTab={handleShiftTab}
onTab={handleTab}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
onChange={handleChange}
/>
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/AddressFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/AddressFieldInput.stories.tsx
index 62f86700a..23eb77f54 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/AddressFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/AddressFieldInput.stories.tsx
@@ -6,7 +6,6 @@ import { useAddressField } from '@/object-record/record-field/meta-types/hooks/u
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { FieldAddressDraftValue } from '@/object-record/record-field/types/FieldInputDraftValue';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import {
AddressInput,
@@ -60,7 +59,6 @@ const AddressInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
}, [instanceId, pushFocusItemToFocusStack]);
@@ -96,7 +94,6 @@ const AddressInputWithContext = ({
onEscape={onEscape}
onClickOutside={onClickOutside}
value={value}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
onTab={onTab}
onShiftTab={onShiftTab}
/>
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/ArrayFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/ArrayFieldInput.stories.tsx
index 100b123ac..de5c77016 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/ArrayFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/ArrayFieldInput.stories.tsx
@@ -7,7 +7,6 @@ import { FieldContext } from '@/object-record/record-field/contexts/FieldContext
import { useArrayField } from '@/object-record/record-field/meta-types/hooks/useArrayField';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -72,7 +71,6 @@ const ArrayInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
}, [pushFocusItemToFocusStack, instanceId]);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/DateTimeFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/DateTimeFieldInput.stories.tsx
index 679d549cb..4452d8c95 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/DateTimeFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/DateTimeFieldInput.stories.tsx
@@ -8,7 +8,6 @@ import { FieldMetadataType } from '~/generated-metadata/graphql';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { StorybookFieldInputDropdownFocusIdSetterEffect } from '~/testing/components/StorybookFieldInputDropdownFocusIdSetterEffect';
@@ -78,7 +77,6 @@ const DateFieldInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
}, [pushFocusItemToFocusStack, instanceId]);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/EmailsFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/EmailsFieldInput.stories.tsx
index 11d0b6ccb..db6c7f4aa 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/EmailsFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/EmailsFieldInput.stories.tsx
@@ -9,7 +9,6 @@ import { useEmailsField } from '@/object-record/record-field/meta-types/hooks/us
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { FieldEmailsValue } from '@/object-record/record-field/types/FieldMetadata';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -73,7 +72,6 @@ const EmailInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
}, [pushFocusItemToFocusStack, instanceId]);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/LinksFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/LinksFieldInput.stories.tsx
index 4da7a3d2a..12b0bae1c 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/LinksFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/LinksFieldInput.stories.tsx
@@ -6,7 +6,6 @@ import { FieldContext } from '@/object-record/record-field/contexts/FieldContext
import { useLinksField } from '@/object-record/record-field/meta-types/hooks/useLinksField';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -83,7 +82,6 @@ const LinksInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
}, [pushFocusItemToFocusStack, instanceId]);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/MultiItemBaseInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/MultiItemBaseInput.stories.tsx
index f9af6d7fc..64a04ac74 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/MultiItemBaseInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/MultiItemBaseInput.stories.tsx
@@ -1,13 +1,13 @@
import { Meta, StoryObj } from '@storybook/react';
-import { MultiItemBaseInput } from '../MultiItemBaseInput';
import { ComponentDecorator } from 'twenty-ui/testing';
+import { MultiItemBaseInput } from '../MultiItemBaseInput';
const meta: Meta = {
title: 'UI/Data/Field/Input/BaseFieldInput',
component: MultiItemBaseInput,
decorators: [ComponentDecorator],
- args: { value: 'Lorem ipsum' },
+ args: { value: 'Lorem ipsum', instanceId: 'multi-item-base-input' },
};
export default meta;
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/NumberFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/NumberFieldInput.stories.tsx
index 91d423c9c..d614e7000 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/NumberFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/NumberFieldInput.stories.tsx
@@ -9,7 +9,6 @@ import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { StorybookFieldInputDropdownFocusIdSetterEffect } from '~/testing/components/StorybookFieldInputDropdownFocusIdSetterEffect';
@@ -59,7 +58,6 @@ const NumberFieldInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
setIsReady(true);
}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/PhonesFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/PhonesFieldInput.stories.tsx
index 7dd6d6cfe..2cf8e48ad 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/PhonesFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/PhonesFieldInput.stories.tsx
@@ -10,7 +10,6 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-fiel
import { FieldInputClickOutsideEvent } from '@/object-record/record-field/types/FieldInputEvent';
import { FieldPhonesValue } from '@/object-record/record-field/types/FieldMetadata';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -74,7 +73,6 @@ const PhoneInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
}, [pushFocusItemToFocusStack, instanceId]);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RatingFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RatingFieldInput.stories.tsx
index d30937167..c0f75995f 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RatingFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RatingFieldInput.stories.tsx
@@ -7,7 +7,6 @@ import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePush
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { FieldMetadataType } from 'twenty-shared/types';
@@ -54,7 +53,6 @@ const RatingFieldInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
}, [pushFocusItemToFocusStack, instanceId]);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationFromManyFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationFromManyFieldInput.stories.tsx
index 3fd8d7675..887ba5722 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationFromManyFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationFromManyFieldInput.stories.tsx
@@ -20,7 +20,6 @@ import { FieldContext } from '@/object-record/record-field/contexts/FieldContext
import { useOpenFieldInputEditMode } from '@/object-record/record-field/hooks/useOpenFieldInputEditMode';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { FieldMetadataType } from 'twenty-shared/types';
import { RelationType } from '~/generated-metadata/graphql';
@@ -78,7 +77,6 @@ const RelationManyFieldInputWithContext = () => {
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: 'relation-from-many-field-input',
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
openFieldInput({
fieldDefinition,
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationToOneFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationToOneFieldInput.stories.tsx
index d9bfc3ce3..65eac3132 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationToOneFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationToOneFieldInput.stories.tsx
@@ -18,7 +18,6 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { recordFieldInputLayoutDirectionLoadingComponentState } from '@/object-record/record-field/states/recordFieldInputLayoutDirectionLoadingComponentState';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
@@ -72,8 +71,6 @@ const RelationToOneFieldInputWithContext = ({
type: FocusComponentType.DROPDOWN,
instanceId: 'relation-to-one-field-input',
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
- memoizeKey: 'relation-to-one-field-input',
});
}, [pushFocusItemToFocusStack]);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RichTextFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RichTextFieldInput.stories.tsx
index dbd529237..524d0ad9f 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RichTextFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RichTextFieldInput.stories.tsx
@@ -5,7 +5,6 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -53,7 +52,6 @@ const RichTextFieldInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
}, [pushFocusItemToFocusStack, instanceId]);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/TextFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/TextFieldInput.stories.tsx
index 6cb873bb3..22406a281 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/TextFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/TextFieldInput.stories.tsx
@@ -6,7 +6,6 @@ import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePush
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { Decorator, Meta, StoryObj } from '@storybook/react';
@@ -56,7 +55,6 @@ const TextFieldInputWithContext = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: instanceId,
},
- hotkeyScope: DEFAULT_CELL_SCOPE,
});
setIsReady(true);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useOpenRelationFromManyFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useOpenRelationFromManyFieldInput.tsx
index 2c32eef8f..9e43dc6e7 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useOpenRelationFromManyFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useOpenRelationFromManyFieldInput.tsx
@@ -11,7 +11,6 @@ import { RecordPickerPickableMorphItem } from '@/object-record/record-picker/typ
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { useRecoilCallback } from 'recoil';
@@ -106,10 +105,9 @@ export const useOpenRelationFromManyFieldInput = () => {
type: FocusComponentType.DROPDOWN,
instanceId: recordPickerInstanceId,
},
- hotkeyScope: {
- scope: DropdownHotkeyScope.Dropdown,
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: recordPickerInstanceId,
});
},
[openMultipleRecordPicker, performSearch, pushFocusItemToFocusStack],
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useOpenRelationToOneFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useOpenRelationToOneFieldInput.tsx
index b8ee44c01..2498a0ee4 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useOpenRelationToOneFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useOpenRelationToOneFieldInput.tsx
@@ -6,7 +6,6 @@ import { useSingleRecordPickerOpen } from '@/object-record/record-picker/single-
import { singleRecordPickerSelectedIdComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSelectedIdComponentState';
import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { useRecoilCallback } from 'recoil';
@@ -58,9 +57,9 @@ export const useOpenRelationToOneFieldInput = () => {
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: recordPickerInstanceId,
},
- // TODO: Remove this once we've fully migrated away from hotkey scopes
- hotkeyScope: { scope: DropdownHotkeyScope.Dropdown },
- memoizeKey: recordPickerInstanceId,
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
+ },
});
},
[openSingleRecordPicker, pushFocusItemToFocusStack],
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents.ts
index b66768770..972e8d7fc 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents.ts
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents.ts
@@ -14,7 +14,6 @@ export const useRegisterInputEvents = ({
onShiftTab,
onClickOutside,
focusId,
- hotkeyScope,
}: {
inputRef: React.RefObject;
copyRef?: React.RefObject;
@@ -25,15 +24,14 @@ export const useRegisterInputEvents = ({
onShiftTab?: (inputValue: T) => void;
onClickOutside?: (event: MouseEvent | TouchEvent, inputValue: T) => void;
focusId: string;
- hotkeyScope: string;
}) => {
useListenClickOutside({
refs: [inputRef, copyRef].filter(isDefined),
callback: (event) => {
onClickOutside?.(event, inputValue);
},
+ listenerId: focusId,
enabled: isDefined(onClickOutside),
- listenerId: hotkeyScope,
});
useHotkeysOnFocusedElement({
@@ -42,7 +40,6 @@ export const useRegisterInputEvents = ({
onEnter?.(inputValue);
},
focusId,
- scope: hotkeyScope,
dependencies: [onEnter, inputValue],
});
@@ -52,7 +49,6 @@ export const useRegisterInputEvents = ({
onEscape?.(inputValue);
},
focusId,
- scope: hotkeyScope,
dependencies: [onEscape, inputValue],
});
@@ -62,7 +58,6 @@ export const useRegisterInputEvents = ({
onTab?.(inputValue);
},
focusId,
- scope: hotkeyScope,
dependencies: [onTab, inputValue],
});
@@ -72,7 +67,6 @@ export const useRegisterInputEvents = ({
onShiftTab?.(inputValue);
},
focusId,
- scope: hotkeyScope,
dependencies: [onShiftTab, inputValue],
});
};
diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useResetFocusStackToRecordIndex.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useResetFocusStackToRecordIndex.ts
index 4ce67a141..784bfc4d8 100644
--- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useResetFocusStackToRecordIndex.ts
+++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useResetFocusStackToRecordIndex.ts
@@ -1,4 +1,3 @@
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { PageFocusId } from '@/types/PageFocusId';
import { useResetFocusStackToFocusItem } from '@/ui/utilities/focus/hooks/useResetFocusStackToFocusItem';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -18,15 +17,6 @@ export const useResetFocusStackToRecordIndex = () => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
- },
- hotkeyScope: {
- scope: RecordIndexHotkeyScope.RecordIndex,
- customScopes: {
- goto: true,
- keyboardShortcutMenu: true,
- searchRecords: true,
- },
},
});
};
diff --git a/packages/twenty-front/src/modules/object-record/record-index/types/RecordIndexHotkeyScope.ts b/packages/twenty-front/src/modules/object-record/record-index/types/RecordIndexHotkeyScope.ts
deleted file mode 100644
index fcdd9d87f..000000000
--- a/packages/twenty-front/src/modules/object-record/record-index/types/RecordIndexHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum RecordIndexHotkeyScope {
- RecordIndex = 'record-index',
-}
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCell.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCell.tsx
index 56f0205d3..092119ec4 100644
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCell.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCell.tsx
@@ -15,9 +15,9 @@ import { useOpenFieldInputEditMode } from '@/object-record/record-field/hooks/us
import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import { isInlineCellInEditModeScopedState } from '@/object-record/record-inline-cell/states/isInlineCellInEditModeScopedState';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
+import { getDropdownFocusIdForRecordField } from '@/object-record/utils/getDropdownFocusIdForRecordField';
import { useGoBackToPreviousDropdownFocusId } from '@/ui/layout/dropdown/hooks/useGoBackToPreviousDropdownFocusId';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
+import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { useRecoilCallback, useSetRecoilState } from 'recoil';
import { useIcons } from 'twenty-ui/display';
@@ -129,11 +129,17 @@ export const RecordInlineCell = ({
const handleClickOutside: FieldInputClickOutsideEvent = useRecoilCallback(
({ snapshot }) =>
(persistField, event) => {
- const hotkeyScope = snapshot
- .getLoadable(currentHotkeyScopeState)
+ const currentFocusId = snapshot
+ .getLoadable(currentFocusIdSelector)
.getValue();
- if (hotkeyScope.scope !== DEFAULT_CELL_SCOPE.scope) {
+ const expectedFocusId = getDropdownFocusIdForRecordField(
+ recordId,
+ fieldDefinition.fieldMetadataId,
+ 'inline-cell',
+ );
+
+ if (currentFocusId !== expectedFocusId) {
return;
}
event.preventDefault();
@@ -142,7 +148,7 @@ export const RecordInlineCell = ({
persistField();
closeInlineCell();
},
- [closeInlineCell],
+ [closeInlineCell, recordId, fieldDefinition.fieldMetadataId],
);
const { getIcon } = useIcons();
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/states/customEditHotkeyScopeForFieldScopedState.ts b/packages/twenty-front/src/modules/object-record/record-inline-cell/states/customEditHotkeyScopeForFieldScopedState.ts
deleted file mode 100644
index 96db47ff9..000000000
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/states/customEditHotkeyScopeForFieldScopedState.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
-import { createFamilyState } from '@/ui/utilities/state/utils/createFamilyState';
-
-export const customEditHotkeyScopeForFieldScopedState = createFamilyState<
- HotkeyScope | null,
- string
->({
- key: 'customEditHotkeyScopeForFieldScopedState',
- defaultValue: null,
-});
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/states/parentHotkeyScopeForFieldScopedState.ts b/packages/twenty-front/src/modules/object-record/record-inline-cell/states/parentHotkeyScopeForFieldScopedState.ts
deleted file mode 100644
index 4562c09cf..000000000
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/states/parentHotkeyScopeForFieldScopedState.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
-import { createFamilyState } from '@/ui/utilities/state/utils/createFamilyState';
-
-export const parentHotkeyScopeForFieldScopedState = createFamilyState<
- HotkeyScope | null,
- string
->({
- key: 'parentHotkeyScopeForFieldScopedState',
- defaultValue: null,
-});
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/types/InlineCellHotkeyScope.ts b/packages/twenty-front/src/modules/object-record/record-inline-cell/types/InlineCellHotkeyScope.ts
deleted file mode 100644
index 7f1b5ed10..000000000
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/types/InlineCellHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum InlineCellHotkeyScope {
- InlineCell = 'inline-cell',
-}
diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker.tsx b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker.tsx
index 88c1df5b1..1ef7c6c46 100644
--- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker.tsx
@@ -11,7 +11,6 @@ import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObj
import { CreateNewButton } from '@/ui/input/relation-picker/components/CreateNewButton';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
@@ -91,7 +90,6 @@ export const MultipleRecordPicker = ({
handleSubmit();
},
focusId,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [handleSubmit],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItems.tsx b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItems.tsx
index d5ad65ab4..c424f98e1 100644
--- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItems.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItems.tsx
@@ -11,7 +11,6 @@ import { multipleRecordPickerPickableRecordIdsMatchingSearchComponentSelector }
import { getMultipleRecordPickerSelectableListId } from '@/object-record/record-picker/multiple-record-picker/utils/getMultipleRecordPickerSelectableListId';
import { RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
@@ -99,7 +98,6 @@ export const MultipleRecordPickerMenuItems = ({
selectableListInstanceId={selectableListComponentInstanceId}
selectableItemIdArray={pickableRecordIds}
focusId={focusId}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{pickableRecordIds.map((recordId) => {
return (
diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems.tsx
index 2588a24cd..ec40e53f9 100644
--- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems.tsx
@@ -10,9 +10,10 @@ import { RecordPickerNoRecordFoundMenuItem } from '@/object-record/record-picker
import { SingleRecordPickerMenuItem } from '@/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItem';
import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext';
import { singleRecordPickerSelectedIdComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSelectedIdComponentState';
+import { singleRecordPickerShouldShowInitialLoadingComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowInitialLoadingComponentState';
+import { singleRecordPickerShouldShowSkeletonComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowSkeletonComponentState';
import { SingleRecordPickerRecord } from '@/object-record/record-picker/single-record-picker/types/SingleRecordPickerRecord';
import { getSingleRecordPickerSelectableListId } from '@/object-record/record-picker/single-record-picker/utils/getSingleRecordPickerSelectableListId';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
import { isSelectedItemIdComponentFamilySelector } from '@/ui/layout/selectable-list/states/selectors/isSelectedItemIdComponentFamilySelector';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
@@ -23,8 +24,6 @@ import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/
import { isDefined } from 'twenty-shared/utils';
import { IconComponent } from 'twenty-ui/display';
import { MenuItemSelect } from 'twenty-ui/navigation';
-import { singleRecordPickerShouldShowInitialLoadingComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowInitialLoadingComponentState';
-import { singleRecordPickerShouldShowSkeletonComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowSkeletonComponentState';
export type SingleRecordPickerMenuItemsProps = {
EmptyIcon?: IconComponent;
@@ -77,7 +76,6 @@ export const SingleRecordPickerMenuItems = ({
onCancel?.();
},
focusId,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [onCancel, resetSelectedItem],
});
@@ -101,7 +99,6 @@ export const SingleRecordPickerMenuItems = ({
{emptyLabel && (
diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWithWrappers.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWithWrappers.tsx
index 63f5d8c0c..1e884e550 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWithWrappers.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWithWrappers.tsx
@@ -1,19 +1,17 @@
-import styled from '@emotion/styled';
-import { useRecoilCallback } from 'recoil';
-
import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
import { RecordTable } from '@/object-record/record-table/components/RecordTable';
+import { RecordTableComponentInstance } from '@/object-record/record-table/components/RecordTableComponentInstance';
+import { RecordTableContextProvider } from '@/object-record/record-table/components/RecordTableContextProvider';
import { EntityDeleteContext } from '@/object-record/record-table/contexts/EntityDeleteHookContext';
import { ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';
+import { PageFocusId } from '@/types/PageFocusId';
+import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import { useSaveCurrentViewFields } from '@/views/hooks/useSaveCurrentViewFields';
import { mapColumnDefinitionsToViewFields } from '@/views/utils/mapColumnDefinitionToViewField';
-
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
-import { RecordTableComponentInstance } from '@/object-record/record-table/components/RecordTableComponentInstance';
-import { RecordTableContextProvider } from '@/object-record/record-table/components/RecordTableContextProvider';
-import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
+import styled from '@emotion/styled';
+import { useRecoilCallback } from 'recoil';
import { RecordUpdateContext } from '../contexts/EntityUpdateMutationHookContext';
import { useRecordTable } from '../hooks/useRecordTable';
@@ -50,8 +48,7 @@ export const RecordTableWithWrappers = ({
useHotkeysOnFocusedElement({
keys: ['ctrl+a,meta+a'],
callback: handleSelectAllRows,
- focusId: recordTableId,
- scope: RecordIndexHotkeyScope.RecordIndex,
+ focusId: PageFocusId.RecordIndex,
dependencies: [handleSelectAllRows],
options: {
enableOnFormTags: false,
diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSelectAllRows.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSelectAllRows.ts
index 45d20105b..67e842c0f 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSelectAllRows.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSelectAllRows.ts
@@ -1,6 +1,7 @@
import { useRecoilCallback } from 'recoil';
import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector';
+import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection';
import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState';
import { allRowsSelectedStatusComponentSelector } from '@/object-record/record-table/states/selectors/allRowsSelectedStatusComponentSelector';
import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
@@ -20,6 +21,8 @@ export const useSelectAllRows = (recordTableId?: string) => {
recordTableId,
);
+ const resetTableRowSelection = useResetTableRowSelection(recordTableId);
+
const selectAllRows = useRecoilCallback(
({ set, snapshot }) =>
() => {
@@ -33,6 +36,10 @@ export const useSelectAllRows = (recordTableId?: string) => {
recordIndexAllRecordIdsSelector,
);
+ if (allRowsSelectedStatus === 'all') {
+ resetTableRowSelection();
+ }
+
for (const recordId of allRecordIds) {
const isSelected =
allRowsSelectedStatus === 'none' ||
@@ -44,6 +51,7 @@ export const useSelectAllRows = (recordTableId?: string) => {
[
allRowsSelectedStatusSelector,
recordIndexAllRecordIdsSelector,
+ resetTableRowSelection,
isRowSelectedFamilyState,
],
);
diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useFocusedRecordTableRow.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useFocusedRecordTableRow.ts
index 753a7518c..4272dbe92 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useFocusedRecordTableRow.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useFocusedRecordTableRow.ts
@@ -1,4 +1,3 @@
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { useUnfocusRecordTableCell } from '@/object-record/record-table/record-table-cell/hooks/useUnfocusRecordTableCell';
import { getRecordTableRowFocusId } from '@/object-record/record-table/record-table-row/utils/getRecordTableRowFocusId';
import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext';
@@ -119,15 +118,6 @@ export const useFocusedRecordTableRow = (recordTableId?: string) => {
type: FocusComponentType.RECORD_TABLE_ROW,
instanceId: focusId,
},
- hotkeyScope: {
- scope: RecordIndexHotkeyScope.RecordIndex,
- customScopes: {
- goto: true,
- keyboardShortcutMenu: true,
- searchRecords: true,
- },
- },
- memoizeKey: focusId,
});
set(focusedRowIndexState, rowIndex);
diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableRowFocusHotkeys.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableRowFocusHotkeys.ts
index 07f22b7a9..f7e0faf27 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableRowFocusHotkeys.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableRowFocusHotkeys.ts
@@ -5,10 +5,8 @@ import { Key } from 'ts-key-enum';
export const useRecordTableRowFocusHotkeys = ({
focusId,
- hotkeyScope,
}: {
focusId: string;
- hotkeyScope: string;
}) => {
const { recordTableId } = useRecordTableContextOrThrow();
@@ -20,7 +18,6 @@ export const useRecordTableRowFocusHotkeys = ({
moveFocusedRow('up');
},
focusId,
- scope: hotkeyScope,
dependencies: [moveFocusedRow],
});
@@ -30,7 +27,6 @@ export const useRecordTableRowFocusHotkeys = ({
moveFocusedRow('down');
},
focusId,
- scope: hotkeyScope,
dependencies: [moveFocusedRow],
});
};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyEscapeHotkeyEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyEscapeHotkeyEffect.tsx
index ae378b005..f509e701f 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyEscapeHotkeyEffect.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyEscapeHotkeyEffect.tsx
@@ -1,6 +1,5 @@
import { Key } from 'ts-key-enum';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext';
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
import { isAtLeastOneTableRowSelectedSelector } from '@/object-record/record-table/record-table-row/states/isAtLeastOneTableRowSelectedSelector';
@@ -29,7 +28,6 @@ export const RecordTableBodyEscapeHotkeyEffect = () => {
keys: [Key.Escape],
callback: handleEscape,
focusId: PageFocusId.RecordIndex,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleEscape],
options: {
preventDefault: true,
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx
index 13a390c59..9a5fdc837 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx
@@ -1,14 +1,11 @@
import { ACTION_MENU_DROPDOWN_CLICK_OUTSIDE_ID } from '@/action-menu/constants/ActionMenuDropdownClickOutsideId';
import { COMMAND_MENU_CLICK_OUTSIDE_ID } from '@/command-menu/constants/CommandMenuClickOutsideId';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { RECORD_TABLE_CLICK_OUTSIDE_LISTENER_ID } from '@/object-record/record-table/constants/RecordTableClickOutsideListenerId';
import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext';
import { useLeaveTableFocus } from '@/object-record/record-table/hooks/internal/useLeaveTableFocus';
import { MODAL_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/modal/constants/ModalBackdropClickOutsideId';
import { PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID } from '@/ui/layout/page/constants/PageActionContainerClickOutsideId';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
-import { useRecoilValue } from 'recoil';
type RecordTableBodyFocusClickOutsideEffectProps = {
tableBodyRef: React.RefObject;
};
@@ -20,8 +17,6 @@ export const RecordTableBodyFocusClickOutsideEffect = ({
const leaveTableFocus = useLeaveTableFocus(recordTableId);
- const currentHotkeyScope = useRecoilValue(currentHotkeyScopeState);
-
useListenClickOutside({
excludedClickOutsideIds: [
ACTION_MENU_DROPDOWN_CLICK_OUTSIDE_ID,
@@ -32,10 +27,6 @@ export const RecordTableBodyFocusClickOutsideEffect = ({
listenerId: RECORD_TABLE_CLICK_OUTSIDE_LISTENER_ID,
refs: [tableBodyRef],
callback: () => {
- if (currentHotkeyScope.scope !== RecordIndexHotkeyScope.RecordIndex) {
- return;
- }
-
leaveTableFocus();
},
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusKeyboardEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusKeyboardEffect.tsx
index e9e591850..2e5a98d42 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusKeyboardEffect.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusKeyboardEffect.tsx
@@ -1,11 +1,9 @@
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { useRecordTableRowFocusHotkeys } from '@/object-record/record-table/hooks/useRecordTableRowFocusHotkeys';
import { PageFocusId } from '@/types/PageFocusId';
export const RecordTableBodyFocusKeyboardEffect = () => {
useRecordTableRowFocusHotkeys({
focusId: PageFocusId.RecordIndex,
- hotkeyScope: RecordIndexHotkeyScope.RecordIndex,
});
return null;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellArrowKeysEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellArrowKeysEffect.tsx
index 3166a50a2..108689eb4 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellArrowKeysEffect.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellArrowKeysEffect.tsx
@@ -1,4 +1,3 @@
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { useCurrentlyFocusedRecordTableCellFocusId } from '@/object-record/record-table/record-table-cell/hooks/useCurrentlyFocusedRecordTableCellFocusId';
import { useRecordTableCellFocusHotkeys } from '@/object-record/record-table/record-table-cell/hooks/useRecordTableCellFocusHotkeys';
@@ -7,7 +6,6 @@ export const RecordTableCellArrowKeysEffect = () => {
useRecordTableCellFocusHotkeys({
focusId: recordTableCellFocusId,
- hotkeyScope: RecordIndexHotkeyScope.RecordIndex,
});
return null;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFieldInput.tsx
index 6b5720b7a..edc956701 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFieldInput.tsx
@@ -1,19 +1,23 @@
import { FieldInput } from '@/object-record/record-field/components/FieldInput';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
+import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/states/contexts/RecordFieldComponentInstanceContext';
import {
FieldInputClickOutsideEvent,
FieldInputEvent,
} from '@/object-record/record-field/types/FieldInputEvent';
import { useRecordTableBodyContextOrThrow } from '@/object-record/record-table/contexts/RecordTableBodyContext';
-import { TableHotkeyScope } from '@/object-record/record-table/types/TableHotkeyScope';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
+import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector';
+import { useAvailableComponentInstanceId } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceId';
import { useContext } from 'react';
import { useRecoilCallback } from 'recoil';
export const RecordTableCellFieldInput = () => {
const { onMoveFocus, onCloseTableCell } = useRecordTableBodyContextOrThrow();
const { isReadOnly } = useContext(FieldContext);
+ const instanceId = useAvailableComponentInstanceId(
+ RecordFieldComponentInstanceContext,
+ );
const handleEnter: FieldInputEvent = (persistField) => {
persistField();
@@ -35,10 +39,11 @@ export const RecordTableCellFieldInput = () => {
const handleClickOutside: FieldInputClickOutsideEvent = useRecoilCallback(
({ snapshot }) =>
(persistField, event) => {
- const hotkeyScope = snapshot
- .getLoadable(currentHotkeyScopeState)
+ const currentFocusId = snapshot
+ .getLoadable(currentFocusIdSelector)
.getValue();
- if (hotkeyScope.scope !== TableHotkeyScope.CellEditMode) {
+
+ if (currentFocusId !== instanceId) {
return;
}
event.preventDefault();
@@ -46,7 +51,7 @@ export const RecordTableCellFieldInput = () => {
persistField();
onCloseTableCell();
},
- [onCloseTableCell],
+ [onCloseTableCell, instanceId],
);
const handleEscape: FieldInputEvent = (persistField) => {
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHotkeysEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHotkeysEffect.tsx
index 57f9b5df1..810ffce1b 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHotkeysEffect.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHotkeysEffect.tsx
@@ -6,10 +6,10 @@ import { useClearField } from '@/object-record/record-field/hooks/useClearField'
import { useIsFieldClearable } from '@/object-record/record-field/hooks/useIsFieldClearable';
import { useIsFieldInputOnly } from '@/object-record/record-field/hooks/useIsFieldInputOnly';
import { useToggleEditOnlyInput } from '@/object-record/record-field/hooks/useToggleEditOnlyInput';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { useRecordTableBodyContextOrThrow } from '@/object-record/record-table/contexts/RecordTableBodyContext';
import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext';
import { useFocusedRecordTableRow } from '@/object-record/record-table/hooks/useFocusedRecordTableRow';
+import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
import { useCurrentlyFocusedRecordTableCellFocusId } from '@/object-record/record-table/record-table-cell/hooks/useCurrentlyFocusedRecordTableCellFocusId';
import { useOpenRecordTableCellFromCell } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell';
import { useListenToSidePanelOpening } from '@/ui/layout/right-drawer/hooks/useListenToSidePanelOpening';
@@ -83,7 +83,6 @@ export const RecordTableCellHotkeysEffect = () => {
keys: [Key.Backspace, Key.Delete],
callback: handleBackspaceOrDelete,
focusId: cellFocusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleBackspaceOrDelete],
});
@@ -91,7 +90,6 @@ export const RecordTableCellHotkeysEffect = () => {
keys: [Key.Enter],
callback: handleEnter,
focusId: cellFocusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleEnter],
});
@@ -99,7 +97,6 @@ export const RecordTableCellHotkeysEffect = () => {
keys: [Key.Escape],
callback: handleEscape,
focusId: cellFocusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleEscape],
});
@@ -107,12 +104,30 @@ export const RecordTableCellHotkeysEffect = () => {
keys: ['*'],
callback: handleAnyKey,
focusId: cellFocusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleAnyKey],
options: {
preventDefault: false,
},
});
+ const { selectAllRows, setHasUserSelectedAllRows } = useRecordTable({
+ recordTableId,
+ });
+
+ const handleSelectAllRows = () => {
+ setHasUserSelectedAllRows(true);
+ selectAllRows();
+ };
+
+ useHotkeysOnFocusedElement({
+ keys: ['ctrl+a,meta+a'],
+ callback: handleSelectAllRows,
+ focusId: cellFocusId,
+ dependencies: [handleSelectAllRows],
+ options: {
+ enableOnFormTags: false,
+ },
+ });
+
return null;
};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/__tests__/useMoveHoverToCurrentCell.test.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/__tests__/useMoveHoverToCurrentCell.test.tsx
index 57e42fcd6..a9794ffc0 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/__tests__/useMoveHoverToCurrentCell.test.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/__tests__/useMoveHoverToCurrentCell.test.tsx
@@ -2,7 +2,6 @@ import { renderHook } from '@testing-library/react';
import { act } from 'react';
import { RecoilRoot, useRecoilValue } from 'recoil';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { RecordTableComponentInstance } from '@/object-record/record-table/components/RecordTableComponentInstance';
import { RecordTableCellContext } from '@/object-record/record-table/contexts/RecordTableCellContext';
import { RecordTableRowContextProvider } from '@/object-record/record-table/contexts/RecordTableRowContext';
@@ -14,17 +13,9 @@ import {
} from '@/object-record/record-table/record-table-cell/hooks/__mocks__/cell';
import { useMoveHoverToCurrentCell } from '@/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell';
import { recordTableHoverPositionComponentState } from '@/object-record/record-table/states/recordTableHoverPositionComponentState';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
const Wrapper = ({ children }: { children: React.ReactNode }) => (
- {
- set(currentHotkeyScopeState, {
- scope: RecordIndexHotkeyScope.RecordIndex,
- customScopes: {},
- });
- }}
- >
+
{
type: FocusComponentType.RECORD_TABLE_CELL,
instanceId: cellFocusId,
},
- hotkeyScope: {
- scope: RecordIndexHotkeyScope.RecordIndex,
- },
- memoizeKey: cellFocusId,
});
};
},
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell.ts
index 459dfefa5..4b782f3a3 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell.ts
@@ -1,16 +1,12 @@
import { useRecoilCallback } from 'recoil';
import { TableCellPosition } from '@/object-record/record-table/types/TableCellPosition';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { recordTableHoverPositionComponentState } from '@/object-record/record-table/states/recordTableHoverPositionComponentState';
import { isSomeCellInEditModeComponentSelector } from '@/object-record/record-table/states/selectors/isSomeCellInEditModeComponentSelector';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
-import { TableHotkeyScope } from '../../types/TableHotkeyScope';
export const useMoveHoverToCurrentCell = (recordTableId: string) => {
const setHoverPosition = useSetRecoilComponentStateV2(
@@ -31,19 +27,6 @@ export const useMoveHoverToCurrentCell = (recordTableId: string) => {
isSomeCellInEditModeSelector,
);
- const currentHotkeyScope = getSnapshotValue(
- snapshot,
- currentHotkeyScopeState,
- );
-
- if (
- currentHotkeyScope.scope !== TableHotkeyScope.CellEditMode &&
- currentHotkeyScope.scope !== AppHotkeyScope.CommandMenuOpen &&
- currentHotkeyScope.scope !== RecordIndexHotkeyScope.RecordIndex
- ) {
- return;
- }
-
if (!isSomeCellInEditMode) {
setHoverPosition(cellPosition);
}
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell.ts
index 6015c3024..67d7affce 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell.ts
@@ -5,22 +5,15 @@ import { FieldDefinition } from '@/object-record/record-field/types/FieldDefinit
import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
import { useRecordTableRowContextOrThrow } from '@/object-record/record-table/contexts/RecordTableRowContext';
import { TableCellPosition } from '@/object-record/record-table/types/TableCellPosition';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { useRecordTableBodyContextOrThrow } from '@/object-record/record-table/contexts/RecordTableBodyContext';
import { RecordTableCellContext } from '@/object-record/record-table/contexts/RecordTableCellContext';
-import { TableHotkeyScope } from '../../types/TableHotkeyScope';
-
-export const DEFAULT_CELL_SCOPE: HotkeyScope = {
- scope: TableHotkeyScope.CellEditMode,
-};
export type OpenTableCellArgs = {
initialValue?: string;
cellPosition: TableCellPosition;
isReadOnly: boolean;
pathToShowPage: string;
- customCellHotkeyScope: HotkeyScope | null;
fieldDefinition: FieldDefinition;
recordId: string;
};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2.ts
index 5484f0c7e..bf1d665f2 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2.ts
@@ -11,7 +11,6 @@ import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/
import { useLeaveTableFocus } from '@/object-record/record-table/hooks/internal/useLeaveTableFocus';
import { TableCellPosition } from '@/object-record/record-table/types/TableCellPosition';
import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { useClickOutsideListener } from '@/ui/utilities/pointer-event/hooks/useClickOutsideListener';
import { getSnapshotValue } from '@/ui/utilities/state/utils/getSnapshotValue';
@@ -33,11 +32,6 @@ import { clickOutsideListenerIsActivatedComponentState } from '@/ui/utilities/po
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
-import { TableHotkeyScope } from '../../types/TableHotkeyScope';
-
-export const DEFAULT_CELL_SCOPE: HotkeyScope = {
- scope: TableHotkeyScope.CellEditMode,
-};
export type OpenTableCellArgs = {
initialValue?: string;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useRecordTableCellFocusHotkeys.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useRecordTableCellFocusHotkeys.ts
index 0be19ccc9..ba254b031 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useRecordTableCellFocusHotkeys.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useRecordTableCellFocusHotkeys.ts
@@ -5,10 +5,8 @@ import { Key } from 'ts-key-enum';
export const useRecordTableCellFocusHotkeys = ({
focusId,
- hotkeyScope,
}: {
focusId: string;
- hotkeyScope: string;
}) => {
const { recordTableId } = useRecordTableContextOrThrow();
@@ -20,7 +18,6 @@ export const useRecordTableCellFocusHotkeys = ({
moveFocus('up');
},
focusId,
- scope: hotkeyScope,
dependencies: [moveFocus],
});
@@ -30,7 +27,6 @@ export const useRecordTableCellFocusHotkeys = ({
moveFocus('down');
},
focusId,
- scope: hotkeyScope,
dependencies: [moveFocus],
});
@@ -40,7 +36,6 @@ export const useRecordTableCellFocusHotkeys = ({
moveFocus('left');
},
focusId,
- scope: hotkeyScope,
dependencies: [moveFocus],
});
@@ -50,7 +45,6 @@ export const useRecordTableCellFocusHotkeys = ({
moveFocus('right');
},
focusId,
- scope: hotkeyScope,
dependencies: [moveFocus],
});
};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowArrowKeysEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowArrowKeysEffect.tsx
index 076ad4fbb..951b64a90 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowArrowKeysEffect.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowArrowKeysEffect.tsx
@@ -1,4 +1,3 @@
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { useRecordTableRowFocusHotkeys } from '@/object-record/record-table/hooks/useRecordTableRowFocusHotkeys';
import { useRecordTableRowFocusId } from '@/object-record/record-table/record-table-row/hooks/useRecordTableRowFocusId';
@@ -7,7 +6,6 @@ export const RecordTableRowArrowKeysEffect = () => {
useRecordTableRowFocusHotkeys({
focusId: recordTableRowFocusId,
- hotkeyScope: RecordIndexHotkeyScope.RecordIndex,
});
return null;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts
index 74fc9b35b..93777f7f7 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts
@@ -1,5 +1,4 @@
import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu';
-import { RecordIndexHotkeyScope } from '@/object-record/record-index/types/RecordIndexHotkeyScope';
import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext';
import { useRecordTableRowContextOrThrow } from '@/object-record/record-table/contexts/RecordTableRowContext';
import { useActiveRecordTableRow } from '@/object-record/record-table/hooks/useActiveRecordTableRow';
@@ -79,10 +78,6 @@ export const useRecordTableRowHotkeys = (focusId: string) => {
type: FocusComponentType.RECORD_TABLE_CELL,
instanceId: cellFocusId,
},
- hotkeyScope: {
- scope: RecordIndexHotkeyScope.RecordIndex,
- },
- memoizeKey: cellFocusId,
});
};
@@ -107,7 +102,6 @@ export const useRecordTableRowHotkeys = (focusId: string) => {
keys: ['x'],
callback: handleSelectRow,
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleSelectRow],
});
@@ -115,7 +109,6 @@ export const useRecordTableRowHotkeys = (focusId: string) => {
keys: [`${Key.Shift}+x`],
callback: handleSelectRowWithShift,
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleSelectRowWithShift],
});
@@ -123,7 +116,6 @@ export const useRecordTableRowHotkeys = (focusId: string) => {
keys: [`${Key.Control}+${Key.Enter}`, `${Key.Meta}+${Key.Enter}`],
callback: handleOpenRecordInCommandMenu,
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleOpenRecordInCommandMenu],
});
@@ -131,7 +123,6 @@ export const useRecordTableRowHotkeys = (focusId: string) => {
keys: [Key.Enter],
callback: handleEnterRow,
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleEnterRow],
});
@@ -139,7 +130,25 @@ export const useRecordTableRowHotkeys = (focusId: string) => {
keys: [Key.Escape],
callback: handleEscape,
focusId,
- scope: RecordIndexHotkeyScope.RecordIndex,
dependencies: [handleEscape],
});
+
+ const { selectAllRows, setHasUserSelectedAllRows } = useRecordTable({
+ recordTableId,
+ });
+
+ const handleSelectAllRows = () => {
+ setHasUserSelectedAllRows(true);
+ selectAllRows();
+ };
+
+ useHotkeysOnFocusedElement({
+ keys: ['ctrl+a,meta+a'],
+ callback: handleSelectAllRows,
+ focusId,
+ dependencies: [handleSelectAllRows],
+ options: {
+ enableOnFormTags: false,
+ },
+ });
};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/types/TableHotkeyScope.ts b/packages/twenty-front/src/modules/object-record/record-table/types/TableHotkeyScope.ts
deleted file mode 100644
index 3695bf17e..000000000
--- a/packages/twenty-front/src/modules/object-record/record-table/types/TableHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum TableHotkeyScope {
- CellEditMode = 'cell-edit-mode',
-}
diff --git a/packages/twenty-front/src/modules/object-record/record-table/types/TableOptionsHotkeyScope.ts b/packages/twenty-front/src/modules/object-record/record-table/types/TableOptionsHotkeyScope.ts
deleted file mode 100644
index 675fe30d1..000000000
--- a/packages/twenty-front/src/modules/object-record/record-table/types/TableOptionsHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum TableOptionsHotkeyScope {
- Dropdown = 'table-options-dropdown',
-}
diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellFieldInput.tsx
index 29d2e1396..5c47ce51c 100644
--- a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellFieldInput.tsx
@@ -6,7 +6,6 @@ import { isFieldFullName } from '@/object-record/record-field/types/guards/isFie
import { isFieldText } from '@/object-record/record-field/types/guards/isFieldText';
import { RecordTitleCellTextFieldInput } from '@/object-record/record-title-cell/components/RecordTitleCellTextFieldInput';
import { RecordTitleFullNameFieldInput } from '@/object-record/record-title-cell/components/RecordTitleFullNameFieldInput';
-import { TitleInputHotkeyScope } from '@/ui/input/types/TitleInputHotkeyScope';
type RecordTitleCellFieldInputProps = {
instanceId: string;
@@ -47,7 +46,6 @@ export const RecordTitleCellFieldInput = ({
onTab={onTab}
onShiftTab={onShiftTab}
sizeVariant={sizeVariant}
- hotkeyScope={TitleInputHotkeyScope.TitleInput}
/>
) : isFieldFullName(fieldDefinition) ? (
) : null}
>
diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellTextFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellTextFieldInput.tsx
index 2222b5be4..8354ba063 100644
--- a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellTextFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellTextFieldInput.tsx
@@ -18,7 +18,6 @@ type RecordTitleCellTextFieldInputProps = {
onTab?: FieldInputEvent;
onShiftTab?: FieldInputEvent;
sizeVariant?: 'xs' | 'md';
- hotkeyScope: string;
};
export const RecordTitleCellTextFieldInput = ({
@@ -29,7 +28,6 @@ export const RecordTitleCellTextFieldInput = ({
onClickOutside,
onTab,
onShiftTab,
- hotkeyScope,
}: RecordTitleCellTextFieldInputProps) => {
const { fieldDefinition, draftValue, setDraftValue } = useTextField();
@@ -60,7 +58,6 @@ export const RecordTitleCellTextFieldInput = ({
onShiftTab: (inputValue) => {
onShiftTab?.(() => persistField(inputValue));
},
- hotkeyScope,
});
const handleFocus = (event: React.FocusEvent) => {
diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleDoubleTextInput.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleDoubleTextInput.tsx
index 888edd838..a71e00bfb 100644
--- a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleDoubleTextInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleDoubleTextInput.tsx
@@ -28,7 +28,6 @@ type RecordTitleDoubleTextInputProps = {
secondValue: string;
firstValuePlaceholder: string;
secondValuePlaceholder: string;
- hotkeyScope: string;
onEnter: (newDoubleTextValue: FieldDoubleText) => void;
onEscape: (newDoubleTextValue: FieldDoubleText) => void;
onTab?: (newDoubleTextValue: FieldDoubleText) => void;
@@ -47,7 +46,6 @@ export const RecordTitleDoubleTextInput = ({
secondValue,
firstValuePlaceholder,
secondValuePlaceholder,
- hotkeyScope,
onClickOutside,
onEnter,
onEscape,
@@ -96,7 +94,6 @@ export const RecordTitleDoubleTextInput = ({
secondValue: secondInternalValue,
});
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [onEnter, firstInternalValue, secondInternalValue],
});
@@ -109,7 +106,6 @@ export const RecordTitleDoubleTextInput = ({
secondValue: secondInternalValue,
});
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [onEscape, firstInternalValue, secondInternalValue],
});
@@ -127,7 +123,6 @@ export const RecordTitleDoubleTextInput = ({
});
}
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [
onTab,
@@ -150,7 +145,6 @@ export const RecordTitleDoubleTextInput = ({
});
}
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [
onShiftTab,
diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldDisplay.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldDisplay.tsx
index 559107252..0a37942b3 100644
--- a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldDisplay.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldDisplay.tsx
@@ -1,9 +1,7 @@
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { useFullNameFieldDisplay } from '@/object-record/record-field/meta-types/hooks/useFullNameFieldDisplay';
-import { INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY } from '@/object-record/record-inline-cell/constants/InlineCellHotkeyScopeMemoizeKey';
import { useInlineCell } from '@/object-record/record-inline-cell/hooks/useInlineCell';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
-import { TitleInputHotkeyScope } from '@/ui/input/types/TitleInputHotkeyScope';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { Theme, withTheme } from '@emotion/react';
@@ -68,10 +66,6 @@ export const RecordTitleFullNameFieldDisplay = ({
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId: recordTitleCellId,
},
- hotkeyScope: {
- scope: TitleInputHotkeyScope.TitleInput,
- },
- memoizeKey: INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY,
});
openInlineCell();
diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldInput.tsx
index 531f86d5a..215ccd191 100644
--- a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldInput.tsx
@@ -16,7 +16,6 @@ type RecordTitleFullNameFieldInputProps = {
onTab?: FieldInputEvent;
onShiftTab?: FieldInputEvent;
sizeVariant?: 'xs' | 'md';
- hotkeyScope: string;
};
export const RecordTitleFullNameFieldInput = ({
@@ -26,7 +25,6 @@ export const RecordTitleFullNameFieldInput = ({
onTab,
onShiftTab,
sizeVariant,
- hotkeyScope,
}: RecordTitleFullNameFieldInputProps) => {
const { draftValue, setDraftValue, persistFullNameField } =
useFullNameField();
@@ -96,7 +94,6 @@ export const RecordTitleFullNameFieldInput = ({
onShiftTab={handleShiftTab}
onTab={handleTab}
onPaste={handlePaste}
- hotkeyScope={hotkeyScope}
onChange={handleChange}
sizeVariant={sizeVariant}
/>
diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/hooks/useRecordTitleCell.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/hooks/useRecordTitleCell.tsx
index 5a1094f77..060e482a3 100644
--- a/packages/twenty-front/src/modules/object-record/record-title-cell/hooks/useRecordTitleCell.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-title-cell/hooks/useRecordTitleCell.tsx
@@ -1,17 +1,13 @@
import { useInitDraftValueV2 } from '@/object-record/record-field/hooks/useInitDraftValueV2';
import { recordIndexFieldDefinitionsState } from '@/object-record/record-index/states/recordIndexFieldDefinitionsState';
-import { INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY } from '@/object-record/record-inline-cell/constants/InlineCellHotkeyScopeMemoizeKey';
import { isInlineCellInEditModeScopedState } from '@/object-record/record-inline-cell/states/isInlineCellInEditModeScopedState';
import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/types/RecordTitleCellContainerType';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
-import { TitleInputHotkeyScope } from '@/ui/input/types/TitleInputHotkeyScope';
import { useGoBackToPreviousDropdownFocusId } from '@/ui/layout/dropdown/hooks/useGoBackToPreviousDropdownFocusId';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { useRecoilCallback } from 'recoil';
-import { isDefined } from 'twenty-shared/utils';
export const useRecordTitleCell = () => {
const { goBackToPreviousDropdownFocusId } =
@@ -64,52 +60,26 @@ export const useRecordTitleCell = () => {
recordId,
fieldName,
containerType,
- customEditHotkeyScopeForField,
}: {
recordId: string;
fieldName: string;
containerType: RecordTitleCellContainerType;
- customEditHotkeyScopeForField?: HotkeyScope;
}) => {
- if (isDefined(customEditHotkeyScopeForField)) {
- pushFocusItemToFocusStack({
- focusId: getRecordFieldInputInstanceId({
+ pushFocusItemToFocusStack({
+ focusId: getRecordFieldInputInstanceId({
+ recordId,
+ fieldName,
+ prefix: containerType,
+ }),
+ component: {
+ type: FocusComponentType.OPENED_FIELD_INPUT,
+ instanceId: getRecordFieldInputInstanceId({
recordId,
fieldName,
prefix: containerType,
}),
- component: {
- type: FocusComponentType.OPENED_FIELD_INPUT,
- instanceId: getRecordFieldInputInstanceId({
- recordId,
- fieldName,
- prefix: containerType,
- }),
- },
- hotkeyScope: customEditHotkeyScopeForField,
- memoizeKey: INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY,
- });
- } else {
- pushFocusItemToFocusStack({
- focusId: getRecordFieldInputInstanceId({
- recordId,
- fieldName,
- prefix: containerType,
- }),
- component: {
- type: FocusComponentType.OPENED_FIELD_INPUT,
- instanceId: getRecordFieldInputInstanceId({
- recordId,
- fieldName,
- prefix: containerType,
- }),
- },
- hotkeyScope: {
- scope: TitleInputHotkeyScope.TitleInput,
- },
- memoizeKey: INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY,
- });
- }
+ },
+ });
const recordTitleCellId = getRecordFieldInputInstanceId({
recordId,
diff --git a/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx b/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx
index 14221dc04..30faad216 100644
--- a/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx
+++ b/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx
@@ -3,7 +3,6 @@ import { Key } from 'ts-key-enum';
import { SelectableItem } from '@/object-record/select/types/SelectableItem';
import { DropdownMenuSkeletonItem } from '@/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
@@ -69,7 +68,6 @@ export const MultipleSelectDropdown = ({
resetSelectedItem();
},
focusId,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [closeDropdown, resetSelectedItem],
});
@@ -86,7 +84,6 @@ export const MultipleSelectDropdown = ({
selectableListInstanceId={selectableListId}
selectableItemIdArray={selectableItemIds}
focusId={focusId}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{itemsInDropdown?.map((item) => {
diff --git a/packages/twenty-front/src/modules/object-record/select/types/SelectFieldHotkeyScope.tsx b/packages/twenty-front/src/modules/object-record/select/types/SelectFieldHotkeyScope.tsx
deleted file mode 100644
index 8c3943203..000000000
--- a/packages/twenty-front/src/modules/object-record/select/types/SelectFieldHotkeyScope.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum SelectFieldHotkeyScope {
- SelectField = 'select-field',
-}
diff --git a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleLabelContainer.tsx b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleLabelContainer.tsx
index ebd8d3d68..69667a1a0 100644
--- a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleLabelContainer.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleLabelContainer.tsx
@@ -5,8 +5,6 @@ import { TitleInput } from '@/ui/input/components/TitleInput';
import styled from '@emotion/styled';
import { t } from '@lingui/core/macro';
-const ROLE_LABEL_EDIT_HOTKEY_SCOPE = 'role-label-edit';
-
const StyledHeaderTitle = styled.div`
color: ${({ theme }) => theme.font.color.primary};
font-weight: ${({ theme }) => theme.font.weight.semiBold};
@@ -45,7 +43,6 @@ export const SettingsRoleLabelContainer = ({
value={settingsDraftRole.label}
onChange={handleChange}
placeholder={t`Role name`}
- hotkeyScope={ROLE_LABEL_EDIT_HOTKEY_SCOPE}
/>
);
diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/types/SettingsServerlessFunctionHotKeyScope.ts b/packages/twenty-front/src/modules/settings/serverless-functions/types/SettingsServerlessFunctionHotKeyScope.ts
deleted file mode 100644
index 589e5118d..000000000
--- a/packages/twenty-front/src/modules/settings/serverless-functions/types/SettingsServerlessFunctionHotKeyScope.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export enum SettingsServerlessFunctionHotkeyScope {
- ServerlessFunction = 'serverless-function',
- ServerlessFunctionNew = 'serverless-function-new',
- ServerlessFunctionDetail = 'serverless-function-detail',
- ServerlessFunctionSettingsTab = 'serverless-function-settings-tab',
- ServerlessFunctionEditorTab = 'serverless-function-editor-tab',
- ServerlessFunctionTestTab = 'serverless-function-test-tab',
-}
diff --git a/packages/twenty-front/src/modules/types/PageHotkeyScope.ts b/packages/twenty-front/src/modules/types/PageHotkeyScope.ts
deleted file mode 100644
index 88ff9499d..000000000
--- a/packages/twenty-front/src/modules/types/PageHotkeyScope.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export enum PageHotkeyScope {
- Settings = 'settings',
- CreateWorkspace = 'create-workspace',
- SignInUp = 'sign-in-up',
- CreateProfile = 'create-profile',
- InviteTeam = 'invite-team',
- SyncEmail = 'sync-email',
- PlanRequired = 'plan-required',
- RecordShowPage = 'record-show-page',
-}
diff --git a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/Dialog.tsx b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/Dialog.tsx
index 072fe99c0..6d2389585 100644
--- a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/Dialog.tsx
+++ b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/Dialog.tsx
@@ -11,7 +11,6 @@ import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useLis
import { useRef } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { Button } from 'twenty-ui/input';
-import { DialogHotkeyScope } from '../types/DialogHotkeyScope';
const StyledDialogOverlay = styled(motion.div)`
align-items: center;
@@ -116,7 +115,6 @@ export const Dialog = ({
keys: [Key.Enter],
callback: handleEnter,
focusId: DIALOG_FOCUS_ID,
- scope: DialogHotkeyScope.Dialog,
dependencies: [buttons],
});
@@ -124,7 +122,6 @@ export const Dialog = ({
keys: [Key.Escape],
callback: handleEscape,
focusId: DIALOG_FOCUS_ID,
- scope: DialogHotkeyScope.Dialog,
dependencies: [handleEscape],
});
diff --git a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManagerEffect.tsx b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManagerEffect.tsx
index f5b5107b6..e641dd93d 100644
--- a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManagerEffect.tsx
+++ b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManagerEffect.tsx
@@ -1,8 +1,6 @@
import { useEffect } from 'react';
import { DIALOG_FOCUS_ID } from '@/ui/feedback/dialog-manager/constants/DialogFocusId';
-import { DIALOG_MANAGER_HOTKEY_SCOPE_MEMOIZE_KEY } from '@/ui/feedback/dialog-manager/constants/DialogManagerHotkeyScopeMemoizeKey';
-import { DialogHotkeyScope } from '@/ui/feedback/dialog-manager/types/DialogHotkeyScope';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { useDialogManagerScopedStates } from '../hooks/internal/useDialogManagerScopedStates';
@@ -23,10 +21,6 @@ export const DialogManagerEffect = () => {
type: FocusComponentType.DIALOG,
instanceId: DIALOG_FOCUS_ID,
},
- hotkeyScope: {
- scope: DialogHotkeyScope.Dialog,
- },
- memoizeKey: DIALOG_MANAGER_HOTKEY_SCOPE_MEMOIZE_KEY,
});
}, [dialogInternal.queue, pushFocusItemToFocusStack]);
diff --git a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/types/DialogHotkeyScope.ts b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/types/DialogHotkeyScope.ts
deleted file mode 100644
index ff5d3a978..000000000
--- a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/types/DialogHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum DialogHotkeyScope {
- Dialog = 'dialog',
-}
diff --git a/packages/twenty-front/src/modules/ui/field/input/components/AddressInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/AddressInput.tsx
index 1b08b38bf..04e4bb1c3 100644
--- a/packages/twenty-front/src/modules/ui/field/input/components/AddressInput.tsx
+++ b/packages/twenty-front/src/modules/ui/field/input/components/AddressInput.tsx
@@ -57,7 +57,6 @@ export type AddressInputProps = {
event: MouseEvent | TouchEvent,
newAddress: FieldAddressDraftValue,
) => void;
- hotkeyScope: string;
clearable?: boolean;
onChange?: (updatedValue: FieldAddressDraftValue) => void;
};
@@ -65,7 +64,6 @@ export type AddressInputProps = {
export const AddressInput = ({
instanceId,
value,
- hotkeyScope,
onTab,
onShiftTab,
onEnter,
@@ -154,7 +152,6 @@ export const AddressInput = ({
useHotkeysOnFocusedElement({
keys: ['tab'],
callback: handleTab,
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [handleTab],
});
@@ -162,7 +159,6 @@ export const AddressInput = ({
useHotkeysOnFocusedElement({
keys: ['shift+tab'],
callback: handleShiftTab,
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [handleShiftTab],
});
@@ -172,7 +168,6 @@ export const AddressInput = ({
callback: () => {
onEnter(internalValue);
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [onEnter, internalValue],
});
@@ -182,7 +177,6 @@ export const AddressInput = ({
callback: () => {
onEscape(internalValue);
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [onEscape, internalValue],
});
diff --git a/packages/twenty-front/src/modules/ui/field/input/components/CurrencyInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/CurrencyInput.tsx
index 38fccc33b..f841cfa72 100644
--- a/packages/twenty-front/src/modules/ui/field/input/components/CurrencyInput.tsx
+++ b/packages/twenty-front/src/modules/ui/field/input/components/CurrencyInput.tsx
@@ -49,7 +49,6 @@ export type CurrencyInputProps = {
onClickOutside: (event: MouseEvent | TouchEvent, inputValue: string) => void;
onChange?: (newText: string) => void;
onSelect?: (newText: string) => void;
- hotkeyScope: string;
};
export const CurrencyInput = ({
@@ -65,7 +64,6 @@ export const CurrencyInput = ({
onClickOutside,
onChange,
onSelect,
- hotkeyScope,
}: CurrencyInputProps) => {
const theme = useTheme();
@@ -91,7 +89,6 @@ export const CurrencyInput = ({
onClickOutside,
onTab,
onShiftTab,
- hotkeyScope,
});
const currency = CURRENCIES.find(({ value }) => value === currencyCode);
diff --git a/packages/twenty-front/src/modules/ui/field/input/components/DateInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/DateInput.tsx
index 8f0086cc1..a94547095 100644
--- a/packages/twenty-front/src/modules/ui/field/input/components/DateInput.tsx
+++ b/packages/twenty-front/src/modules/ui/field/input/components/DateInput.tsx
@@ -1,14 +1,13 @@
import { useRef, useState } from 'react';
import { useRegisterInputEvents } from '@/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents';
-import { TableHotkeyScope } from '@/object-record/record-table/types/TableHotkeyScope';
import {
DateTimePicker,
MONTH_AND_YEAR_DROPDOWN_MONTH_SELECT_ID,
MONTH_AND_YEAR_DROPDOWN_YEAR_SELECT_ID,
} from '@/ui/input/components/internal/date/components/InternalDatePicker';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
+import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector';
import { useRecoilCallback } from 'recoil';
import { Nullable } from 'twenty-ui/utilities';
@@ -27,7 +26,6 @@ export type DateInputProps = {
onClear?: () => void;
onSubmit?: (newDate: Nullable) => void;
hideHeaderInput?: boolean;
- hotkeyScope: string;
};
export const DateInput = ({
@@ -42,7 +40,6 @@ export const DateInput = ({
onClear,
onSubmit,
hideHeaderInput,
- hotkeyScope,
}: DateInputProps) => {
const [internalValue, setInternalValue] = useState(value);
@@ -83,17 +80,18 @@ export const DateInput = ({
const handleClickOutside = useRecoilCallback(
({ snapshot }) =>
(event: MouseEvent | TouchEvent) => {
- const hotkeyScope = snapshot
- .getLoadable(currentHotkeyScopeState)
+ const currentFocusId = snapshot
+ .getLoadable(currentFocusIdSelector)
.getValue();
- if (hotkeyScope?.scope === TableHotkeyScope.CellEditMode) {
+ if (currentFocusId === instanceId) {
closeDropdownYearSelect(MONTH_AND_YEAR_DROPDOWN_YEAR_SELECT_ID);
closeDropdownMonthSelect(MONTH_AND_YEAR_DROPDOWN_MONTH_SELECT_ID);
onClickOutside(event, internalValue);
}
},
[
+ instanceId,
closeDropdownYearSelect,
closeDropdownMonthSelect,
onClickOutside,
@@ -108,7 +106,6 @@ export const DateInput = ({
onEnter: handleEnter,
onEscape: handleEscape,
onClickOutside: handleClickOutside,
- hotkeyScope: hotkeyScope,
});
return (
diff --git a/packages/twenty-front/src/modules/ui/field/input/components/DoubleTextInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/DoubleTextInput.tsx
index e500afb85..c37fb2fa6 100644
--- a/packages/twenty-front/src/modules/ui/field/input/components/DoubleTextInput.tsx
+++ b/packages/twenty-front/src/modules/ui/field/input/components/DoubleTextInput.tsx
@@ -34,7 +34,6 @@ type DoubleTextInputProps = {
secondValue: string;
firstValuePlaceholder: string;
secondValuePlaceholder: string;
- hotkeyScope: string;
onEnter: (newDoubleTextValue: FieldDoubleText) => void;
onEscape: (newDoubleTextValue: FieldDoubleText) => void;
onTab?: (newDoubleTextValue: FieldDoubleText) => void;
@@ -53,7 +52,6 @@ export const DoubleTextInput = ({
secondValue,
firstValuePlaceholder,
secondValuePlaceholder,
- hotkeyScope,
onClickOutside,
onEnter,
onEscape,
@@ -97,7 +95,6 @@ export const DoubleTextInput = ({
secondValue: secondInternalValue,
});
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [onEnter, firstInternalValue, secondInternalValue],
});
@@ -110,7 +107,6 @@ export const DoubleTextInput = ({
secondValue: secondInternalValue,
});
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [onEscape, firstInternalValue, secondInternalValue],
});
@@ -128,7 +124,6 @@ export const DoubleTextInput = ({
});
}
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [
onTab,
@@ -151,7 +146,6 @@ export const DoubleTextInput = ({
});
}
},
- scope: hotkeyScope,
focusId: instanceId,
dependencies: [
onShiftTab,
diff --git a/packages/twenty-front/src/modules/ui/field/input/components/MultiSelectInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/MultiSelectInput.tsx
index 00a6ef1a5..53e04404a 100644
--- a/packages/twenty-front/src/modules/ui/field/input/components/MultiSelectInput.tsx
+++ b/packages/twenty-front/src/modules/ui/field/input/components/MultiSelectInput.tsx
@@ -2,7 +2,6 @@ import { useRef, useState } from 'react';
import { Key } from 'ts-key-enum';
import { FieldMultiSelectValue } from '@/object-record/record-field/types/FieldMetadata';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
@@ -81,7 +80,6 @@ export const MultiSelectInput = ({
resetSelectedItem();
},
focusId,
- scope: DEFAULT_CELL_SCOPE.scope,
dependencies: [onCancel, resetSelectedItem],
});
@@ -109,7 +107,6 @@ export const MultiSelectInput = ({
selectableListInstanceId={selectableListComponentInstanceId}
selectableItemIdArray={optionIds}
focusId={focusId}
- hotkeyScope={DEFAULT_CELL_SCOPE.scope}
>
void;
onShiftTab?: (newText: string) => void;
onClickOutside: (event: MouseEvent | TouchEvent, inputValue: string) => void;
- hotkeyScope: string;
onChange?: (newText: string) => void;
maxRows?: number;
copyButton?: boolean;
@@ -53,7 +52,6 @@ export const TextAreaInput = ({
placeholder,
autoFocus,
value,
- hotkeyScope,
onEnter,
onEscape,
onTab,
@@ -94,7 +92,6 @@ export const TextAreaInput = ({
onClickOutside,
onTab,
onShiftTab,
- hotkeyScope,
});
return (
diff --git a/packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx
index 3a37f9e35..cf42945af 100644
--- a/packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx
+++ b/packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx
@@ -25,7 +25,6 @@ type TextInputProps = {
onTab?: (newText: string) => void;
onShiftTab?: (newText: string) => void;
onClickOutside?: (event: MouseEvent | TouchEvent, inputValue: string) => void;
- hotkeyScope: string;
onChange?: (newText: string) => void;
copyButton?: boolean;
shouldTrim?: boolean;
@@ -45,7 +44,6 @@ export const TextInput = ({
placeholder,
autoFocus,
value,
- hotkeyScope,
onEnter,
onEscape,
onTab,
@@ -79,7 +77,6 @@ export const TextInput = ({
onClickOutside,
onTab,
onShiftTab,
- hotkeyScope,
});
return (
diff --git a/packages/twenty-front/src/modules/ui/field/input/components/__stories__/MultiSelectInput.stories.tsx b/packages/twenty-front/src/modules/ui/field/input/components/__stories__/MultiSelectInput.stories.tsx
index 85dee5f99..3b790b59b 100644
--- a/packages/twenty-front/src/modules/ui/field/input/components/__stories__/MultiSelectInput.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/field/input/components/__stories__/MultiSelectInput.stories.tsx
@@ -1,6 +1,4 @@
import { FieldMultiSelectValue } from '@/object-record/record-field/types/FieldMetadata';
-import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
-import { TableHotkeyScope } from '@/object-record/record-table/types/TableHotkeyScope';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
@@ -80,6 +78,12 @@ const priorityOptions: SelectOption[] = [
{ value: 'urgent', label: 'Urgent', color: 'red' },
];
+const instanceId = getRecordFieldInputInstanceId({
+ recordId: '123',
+ fieldName: 'Relation',
+ prefix: 'multi-select-story',
+});
+
const Render = ({
values,
options,
@@ -94,23 +98,11 @@ const Render = ({
useEffect(() => {
pushFocusItemToFocusStack({
- focusId: TableHotkeyScope.CellEditMode,
+ focusId: instanceId,
component: {
type: FocusComponentType.DROPDOWN,
- instanceId: getRecordFieldInputInstanceId({
- recordId: '123',
- fieldName: 'Relation',
- prefix: 'multi-select-story',
- }),
+ instanceId,
},
- hotkeyScope: {
- scope: TableHotkeyScope.CellEditMode,
- },
- memoizeKey: getRecordFieldInputInstanceId({
- recordId: '123',
- fieldName: 'Relation',
- prefix: 'multi-select-story',
- }),
});
}, [pushFocusItemToFocusStack]);
@@ -125,7 +117,7 @@ const Render = ({
selectableListComponentInstanceId="multi-select-story"
values={currentValues}
options={options}
- focusId={DEFAULT_CELL_SCOPE.scope}
+ focusId={instanceId}
onCancel={onCancel}
onOptionSelected={handleOptionSelected}
dropdownWidth={dropdownWidth}
diff --git a/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx b/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx
index 53bdecd9c..de15f553a 100644
--- a/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx
@@ -10,7 +10,6 @@ import { arrayToChunks } from '~/utils/array/arrayToChunks';
import { ICON_PICKER_DROPDOWN_CONTENT_WIDTH } from '@/ui/input/components/constants/IconPickerDropdownContentWidth';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { DropdownOffset } from '@/ui/layout/dropdown/types/DropdownOffset';
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
@@ -223,7 +222,6 @@ export const IconPicker = ({
selectableListInstanceId={selectableListInstanceId}
selectableItemIdMatrix={iconKeys2d}
focusId={dropdownId}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
({
selectableListInstanceId={dropdownId}
focusId={dropdownId}
selectableItemIdArray={selectableItemIdArray}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{filteredOptions.map((option) => (
void;
placeholder?: string;
- hotkeyScope?: string;
onEnter?: () => void;
onEscape?: () => void;
onClickOutside?: () => void;
@@ -63,7 +62,6 @@ const Input = ({
value,
onChange,
placeholder,
- hotkeyScope = 'title-input',
onEnter,
onEscape,
onClickOutside,
@@ -115,7 +113,6 @@ const Input = ({
handleLeaveFocus();
onShiftTab?.();
},
- hotkeyScope: hotkeyScope,
});
return (
@@ -143,7 +140,6 @@ export const TitleInput = ({
sizeVariant = 'md',
onChange,
placeholder,
- hotkeyScope = 'title-input',
onEnter,
onEscape,
onClickOutside,
@@ -163,7 +159,6 @@ export const TitleInput = ({
value={value}
onChange={onChange}
placeholder={placeholder}
- hotkeyScope={hotkeyScope}
onEnter={onEnter}
onEscape={onEscape}
onClickOutside={onClickOutside}
@@ -187,7 +182,6 @@ export const TitleInput = ({
globalHotkeysConfig: {
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- hotkeyScope: { scope: hotkeyScope },
});
}
}}
diff --git a/packages/twenty-front/src/modules/ui/input/components/__stories__/TitleInput.stories.tsx b/packages/twenty-front/src/modules/ui/input/components/__stories__/TitleInput.stories.tsx
index 496636841..a8469f383 100644
--- a/packages/twenty-front/src/modules/ui/input/components/__stories__/TitleInput.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/__stories__/TitleInput.stories.tsx
@@ -9,11 +9,9 @@ const meta: Meta = {
decorators: [ComponentDecorator],
args: {
placeholder: 'Enter title',
- hotkeyScope: 'titleInput',
sizeVariant: 'md',
},
argTypes: {
- hotkeyScope: { control: false },
sizeVariant: { control: false },
},
};
diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx
index 0adfd5f14..88053588d 100644
--- a/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx
@@ -4,8 +4,6 @@ import styled from '@emotion/styled';
import { CurrencyCode } from '@/object-record/record-field/types/CurrencyCode';
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
-import { CurrencyPickerHotkeyScope } from '../types/CurrencyPickerHotkeyScope';
-
import { CURRENCIES } from '@/settings/data-model/constants/Currencies';
import { Currency } from '@/ui/input/components/internal/types/Currency';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
@@ -52,7 +50,7 @@ export const CurrencyPickerDropdownButton = ({
}) => {
const theme = useTheme();
- const dropdownId = CurrencyPickerHotkeyScope.CurrencyPicker;
+ const dropdownId = 'currency-picker-dropdown-id';
const { closeDropdown } = useCloseDropdown();
@@ -69,7 +67,7 @@ export const CurrencyPickerDropdownButton = ({
return (
diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/currency/types/CurrencyPickerHotkeyScope.ts b/packages/twenty-front/src/modules/ui/input/components/internal/currency/types/CurrencyPickerHotkeyScope.ts
deleted file mode 100644
index e6e54967c..000000000
--- a/packages/twenty-front/src/modules/ui/input/components/internal/currency/types/CurrencyPickerHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum CurrencyPickerHotkeyScope {
- CurrencyPicker = 'currency-picker-dropdown-id',
-}
diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/phone/types/CountryPickerHotkeyScope.ts b/packages/twenty-front/src/modules/ui/input/components/internal/phone/types/CountryPickerHotkeyScope.ts
deleted file mode 100644
index eb1a05f3f..000000000
--- a/packages/twenty-front/src/modules/ui/input/components/internal/phone/types/CountryPickerHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum CountryPickerHotkeyScope {
- CountryPicker = 'country-picker',
-}
diff --git a/packages/twenty-front/src/modules/ui/input/types/InputHotkeyScope.ts b/packages/twenty-front/src/modules/ui/input/types/InputHotkeyScope.ts
deleted file mode 100644
index 1aa624b67..000000000
--- a/packages/twenty-front/src/modules/ui/input/types/InputHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum InputHotkeyScope {
- TextInput = 'text-input',
-}
diff --git a/packages/twenty-front/src/modules/ui/input/types/TitleInputHotkeyScope.ts b/packages/twenty-front/src/modules/ui/input/types/TitleInputHotkeyScope.ts
deleted file mode 100644
index 4f265fa3b..000000000
--- a/packages/twenty-front/src/modules/ui/input/types/TitleInputHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum TitleInputHotkeyScope {
- TitleInput = 'title-input',
-}
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuInput.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuInput.tsx
index 50e63dc0b..ca1503e77 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuInput.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuInput.tsx
@@ -53,7 +53,6 @@ type HTMLInputProps = InputHTMLAttributes;
export type DropdownMenuInputProps = HTMLInputProps & {
instanceId: string;
- hotkeyScope?: string;
onClickOutside?: () => void;
onEnter?: () => void;
onEscape?: () => void;
@@ -81,7 +80,6 @@ export const DropdownMenuInput = forwardRef<
value,
placeholder,
instanceId,
- hotkeyScope = 'dropdown-menu-input',
onChange,
onClickOutside,
onEnter = () => {},
@@ -107,7 +105,6 @@ export const DropdownMenuInput = forwardRef<
onClickOutside,
onTab,
onShiftTab,
- hotkeyScope,
});
return (
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/Dropdown.stories.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/Dropdown.stories.tsx
index 6cd8985c5..0073766d8 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/Dropdown.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/Dropdown.stories.tsx
@@ -9,12 +9,9 @@ import { DropdownMenuSkeletonItem } from '@/ui/input/relation-picker/components/
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
import { Modal } from '@/ui/layout/modal/components/Modal';
-import { ModalHotkeyScope } from '@/ui/layout/modal/components/types/ModalHotkeyScope';
import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';
import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
-import { internalHotkeysEnabledScopesState } from '@/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState';
import { SetRecoilState } from 'recoil';
import { Avatar, IconChevronLeft } from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
@@ -377,17 +374,6 @@ const initializeModalState = ({ set }: { set: SetRecoilState }) => {
true,
);
- set(currentHotkeyScopeState, {
- scope: ModalHotkeyScope.ModalFocus,
- customScopes: {
- commandMenu: true,
- goto: false,
- keyboardShortcutMenu: false,
- },
- });
-
- set(internalHotkeysEnabledScopesState, [ModalHotkeyScope.ModalFocus]);
-
set(focusStackState, [
{
focusId: modalId,
@@ -399,7 +385,6 @@ const initializeModalState = ({ set }: { set: SetRecoilState }) => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
},
]);
};
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenuInput.stories.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenuInput.stories.tsx
index 3a1bf780a..4252322f2 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenuInput.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenuInput.stories.tsx
@@ -1,13 +1,13 @@
import { Meta, StoryObj } from '@storybook/react';
-import { DropdownMenuInput } from '../DropdownMenuInput';
import { ComponentDecorator } from 'twenty-ui/testing';
+import { DropdownMenuInput } from '../DropdownMenuInput';
const meta: Meta = {
title: 'UI/Layout/Dropdown/DropdownMenuInput',
component: DropdownMenuInput,
decorators: [ComponentDecorator],
- args: { value: 'Lorem ipsum' },
+ args: { value: 'Lorem ipsum', instanceId: 'dropdown-menu-input' },
};
export default meta;
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/internal/DropdownInternalContainer.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/internal/DropdownInternalContainer.tsx
index 8f4b8fd99..3cc703e7e 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/internal/DropdownInternalContainer.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/internal/DropdownInternalContainer.tsx
@@ -1,5 +1,4 @@
import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { activeDropdownFocusIdState } from '@/ui/layout/dropdown/states/activeDropdownFocusIdState';
@@ -127,7 +126,6 @@ export const DropdownInternalContainer = ({
}
},
focusId: dropdownId,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [
closeDropdown,
isDropdownOpen,
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/constants/DropdownHotkeyScope.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/constants/DropdownHotkeyScope.ts
deleted file mode 100644
index 8f6e48494..000000000
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/constants/DropdownHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum DropdownHotkeyScope {
- Dropdown = 'dropdown',
-}
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/useOpenDropdown.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/useOpenDropdown.ts
index 9fb769b64..9059471ef 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/useOpenDropdown.ts
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/useOpenDropdown.ts
@@ -5,7 +5,6 @@ import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDrop
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { GlobalHotkeysConfig } from '@/ui/utilities/hotkey/types/GlobalHotkeysConfig';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { useAvailableComponentInstanceId } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceId';
import { useRecoilCallback } from 'recoil';
import { isDefined } from 'twenty-shared/utils';
@@ -52,9 +51,6 @@ export const useOpenDropdown = () => {
instanceId: dropdownComponentInstanceId,
},
globalHotkeysConfig: args?.globalHotkeysConfig ?? undefined,
- // TODO: Remove this once we've fully migrated away from hotkey scopes
- hotkeyScope: { scope: 'dropdown' } as HotkeyScope,
- memoizeKey: 'global',
});
},
[
diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx
index d1feb0c16..546d372ef 100644
--- a/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx
@@ -1,6 +1,5 @@
import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';
import { ModalHotkeysAndClickOutsideEffect } from '@/ui/layout/modal/components/ModalHotkeysAndClickOutsideEffect';
-import { ModalHotkeyScope } from '@/ui/layout/modal/components/types/ModalHotkeyScope';
import { ModalComponentInstanceContext } from '@/ui/layout/modal/contexts/ModalComponentInstanceContext';
import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';
@@ -191,7 +190,6 @@ export type ModalProps = React.PropsWithChildren & {
size?: ModalSize;
padding?: ModalPadding;
className?: string;
- hotkeyScope?: ModalHotkeyScope;
onEnter?: () => void;
modalVariant?: ModalVariants;
dataGloballyPreventClickOutside?: boolean;
diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/ModalHotkeysAndClickOutsideEffect.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/ModalHotkeysAndClickOutsideEffect.tsx
index db8cccdf9..76f5b548a 100644
--- a/packages/twenty-front/src/modules/ui/layout/modal/components/ModalHotkeysAndClickOutsideEffect.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/modal/components/ModalHotkeysAndClickOutsideEffect.tsx
@@ -1,5 +1,4 @@
import { DIALOG_CLICK_OUTSIDE_ID } from '@/ui/feedback/dialog-manager/constants/DialogClickOutsideId';
-import { ModalHotkeyScope } from '@/ui/layout/modal/components/types/ModalHotkeyScope';
import { MODAL_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID } from '@/ui/layout/modal/constants/ModalClickOutsideListenerExcludedClassName';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
@@ -26,8 +25,6 @@ export const ModalHotkeysAndClickOutsideEffect = ({
onEnter?.();
},
focusId: modalId,
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- scope: ModalHotkeyScope.ModalFocus,
dependencies: [onEnter],
});
@@ -39,8 +36,6 @@ export const ModalHotkeysAndClickOutsideEffect = ({
}
},
focusId: modalId,
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- scope: ModalHotkeyScope.ModalFocus,
dependencies: [isClosable, onClose],
});
diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/ConfirmationModal.stories.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/ConfirmationModal.stories.tsx
index cfa5d94e5..1d9e64550 100644
--- a/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/ConfirmationModal.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/ConfirmationModal.stories.tsx
@@ -1,11 +1,8 @@
import { Meta, StoryObj } from '@storybook/react';
import { expect, fn, userEvent, waitFor, within } from '@storybook/test';
-import { ModalHotkeyScope } from '@/ui/layout/modal/components/types/ModalHotkeyScope';
import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
-import { internalHotkeysEnabledScopesState } from '@/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState';
import { SetRecoilState } from 'recoil';
import { ComponentDecorator } from 'twenty-ui/testing';
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
@@ -22,17 +19,6 @@ const initializeState = ({ set }: { set: SetRecoilState }) => {
true,
);
- set(currentHotkeyScopeState, {
- scope: ModalHotkeyScope.ModalFocus,
- customScopes: {
- commandMenu: true,
- goto: false,
- keyboardShortcutMenu: false,
- },
- });
-
- set(internalHotkeysEnabledScopesState, [ModalHotkeyScope.ModalFocus]);
-
set(focusStackState, [
{
focusId: 'confirmation-modal',
@@ -44,7 +30,6 @@ const initializeState = ({ set }: { set: SetRecoilState }) => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
},
]);
};
diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/Modal.stories.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/Modal.stories.tsx
index 68e5dd90a..3d3c25640 100644
--- a/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/Modal.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/Modal.stories.tsx
@@ -1,11 +1,8 @@
import { Meta, StoryObj } from '@storybook/react';
import { expect, fn, userEvent, waitFor, within } from '@storybook/test';
-import { ModalHotkeyScope } from '@/ui/layout/modal/components/types/ModalHotkeyScope';
import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
-import { internalHotkeysEnabledScopesState } from '@/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState';
import { SetRecoilState } from 'recoil';
import { ComponentDecorator } from 'twenty-ui/testing';
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
@@ -22,17 +19,6 @@ const initializeState = ({ set }: { set: SetRecoilState }) => {
true,
);
- set(currentHotkeyScopeState, {
- scope: ModalHotkeyScope.ModalFocus,
- customScopes: {
- commandMenu: true,
- goto: false,
- keyboardShortcutMenu: false,
- },
- });
-
- set(internalHotkeysEnabledScopesState, [ModalHotkeyScope.ModalFocus]);
-
set(focusStackState, [
{
focusId: 'modal-id',
@@ -44,7 +30,6 @@ const initializeState = ({ set }: { set: SetRecoilState }) => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
},
]);
};
diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/types/ModalHotkeyScope.ts b/packages/twenty-front/src/modules/ui/layout/modal/components/types/ModalHotkeyScope.ts
deleted file mode 100644
index 6d6f26b82..000000000
--- a/packages/twenty-front/src/modules/ui/layout/modal/components/types/ModalHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum ModalHotkeyScope {
- ModalFocus = 'modal-focus',
-}
diff --git a/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.ts b/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.ts
index 5f9511e1b..dc8aa69cf 100644
--- a/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.ts
+++ b/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.ts
@@ -3,24 +3,13 @@ import { RecoilRoot, useRecoilValue } from 'recoil';
import { useModal } from '@/ui/layout/modal/hooks/useModal';
import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';
-import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { act } from 'react';
-jest.mock('@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope');
-
-const mockSetHotkeyScopeAndMemorizePreviousScope = jest.fn();
-const mockGoBackToPreviousHotkeyScope = jest.fn();
-
const modalId = 'test-modal-id';
describe('useModal', () => {
beforeEach(() => {
jest.clearAllMocks();
- (usePreviousHotkeyScope as jest.Mock).mockReturnValue({
- setHotkeyScopeAndMemorizePreviousScope:
- mockSetHotkeyScopeAndMemorizePreviousScope,
- goBackToPreviousHotkeyScope: mockGoBackToPreviousHotkeyScope,
- });
});
it('should open a modal', () => {
@@ -68,7 +57,6 @@ describe('useModal', () => {
});
expect(result.current.isModalOpened).toBe(false);
- expect(mockGoBackToPreviousHotkeyScope).toHaveBeenCalled();
});
it('should toggle a modal (open when closed)', () => {
@@ -118,6 +106,5 @@ describe('useModal', () => {
});
expect(result.current.isModalOpened).toBe(false);
- expect(mockGoBackToPreviousHotkeyScope).toHaveBeenCalled();
});
});
diff --git a/packages/twenty-front/src/modules/ui/layout/modal/hooks/useModal.tsx b/packages/twenty-front/src/modules/ui/layout/modal/hooks/useModal.tsx
index 342183078..767e86e47 100644
--- a/packages/twenty-front/src/modules/ui/layout/modal/hooks/useModal.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/modal/hooks/useModal.tsx
@@ -1,4 +1,3 @@
-import { ModalHotkeyScope } from '@/ui/layout/modal/components/types/ModalHotkeyScope';
import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';
@@ -63,17 +62,6 @@ export const useModal = () => {
enableGlobalHotkeysWithModifiers: false,
enableGlobalHotkeysConflictingWithKeyboard: false,
},
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- hotkeyScope: {
- scope: ModalHotkeyScope.ModalFocus,
- customScopes: {
- goto: false,
- commandMenu: false,
- commandMenuOpen: false,
- keyboardShortcutMenu: false,
- },
- },
- memoizeKey: modalId,
});
},
[pushFocusItemToFocusStack],
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableList.tsx b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableList.tsx
index fa10a4950..f38d00802 100644
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableList.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableList.tsx
@@ -15,7 +15,6 @@ type SelectableListProps = {
onSelect?: (selected: string) => void;
selectableListInstanceId: string;
focusId: string;
- hotkeyScope: string;
};
export const SelectableList = ({
@@ -25,14 +24,8 @@ export const SelectableList = ({
selectableListInstanceId,
onSelect,
focusId,
- hotkeyScope,
}: SelectableListProps) => {
- useSelectableListHotKeys(
- selectableListInstanceId,
- hotkeyScope,
- focusId,
- onSelect,
- );
+ useSelectableListHotKeys(selectableListInstanceId, focusId, onSelect);
const setSelectableItemIds = useSetRecoilComponentStateV2(
selectableItemIdsComponentState,
@@ -61,7 +54,7 @@ export const SelectableList = ({
instanceId: selectableListInstanceId,
}}
>
-
+
{children}
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableListItemHotkeyEffect.tsx b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableListItemHotkeyEffect.tsx
index 545809b18..695fa265e 100644
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableListItemHotkeyEffect.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableListItemHotkeyEffect.tsx
@@ -8,13 +8,12 @@ export const SelectableListItemHotkeyEffect = ({
itemId: string;
onEnter: () => void;
}) => {
- const { focusId, hotkeyScope } = useSelectableListContextOrThrow();
+ const { focusId } = useSelectableListContextOrThrow();
useSelectableListListenToEnterHotkeyOnItem({
focusId,
itemId,
onEnter,
- hotkeyScope,
});
return null;
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys.ts
index 2a9aff480..0fb586657 100644
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys.ts
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys.ts
@@ -12,8 +12,6 @@ type Direction = 'up' | 'down' | 'left' | 'right';
export const useSelectableListHotKeys = (
instanceId: string,
- // TODO: Remove this after migration to focus stack
- hotkeyScope: string,
focusId: string,
onSelect?: (itemId: string) => void,
) => {
@@ -140,7 +138,6 @@ export const useSelectableListHotKeys = (
keys: Key.ArrowUp,
callback: () => handleSelect('up'),
focusId,
- scope: hotkeyScope,
dependencies: [handleSelect],
});
@@ -148,7 +145,6 @@ export const useSelectableListHotKeys = (
keys: Key.ArrowDown,
callback: () => handleSelect('down'),
focusId,
- scope: hotkeyScope,
dependencies: [handleSelect],
});
@@ -156,7 +152,6 @@ export const useSelectableListHotKeys = (
keys: Key.ArrowLeft,
callback: () => handleSelect('left'),
focusId,
- scope: hotkeyScope,
dependencies: [handleSelect],
});
@@ -164,7 +159,6 @@ export const useSelectableListHotKeys = (
keys: Key.ArrowRight,
callback: () => handleSelect('right'),
focusId,
- scope: hotkeyScope,
dependencies: [handleSelect],
});
};
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/useSelectableListListenToEnterHotkeyOnItem.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/useSelectableListListenToEnterHotkeyOnItem.ts
index d8a600672..9a5ef7eb4 100644
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/useSelectableListListenToEnterHotkeyOnItem.ts
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/useSelectableListListenToEnterHotkeyOnItem.ts
@@ -11,13 +11,10 @@ export const useSelectableListListenToEnterHotkeyOnItem = ({
focusId,
itemId,
onEnter,
- hotkeyScope,
}: {
focusId: string;
itemId: string;
onEnter: () => void;
- // TODO: Remove this after migration to focus stack
- hotkeyScope: string;
}) => {
const instanceId = useAvailableComponentInstanceIdOrThrow(
SelectableListComponentInstanceContext,
@@ -42,7 +39,6 @@ export const useSelectableListListenToEnterHotkeyOnItem = ({
[instanceId, itemId, onEnter],
),
focusId,
- scope: hotkeyScope,
dependencies: [itemId, onEnter],
});
};
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/contexts/SelectableListContext.tsx b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/contexts/SelectableListContext.tsx
index 7722d75d7..b37608aba 100644
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/contexts/SelectableListContext.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/contexts/SelectableListContext.tsx
@@ -2,7 +2,6 @@ import { createRequiredContext } from '~/utils/createRequiredContext';
export type SelectableListContextValue = {
focusId: string;
- hotkeyScope: string;
};
export const [SelectableListContextProvider, useSelectableListContextOrThrow] =
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerInput.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerInput.tsx
index 7c621a022..bc037a5ad 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerInput.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerInput.tsx
@@ -18,7 +18,6 @@ type NavigationDrawerInputProps = {
onSubmit: (value: string) => void;
onCancel: (value: string) => void;
onClickOutside: (event: MouseEvent | TouchEvent, value: string) => void;
- hotkeyScope: string;
};
const NAVIGATION_DRAWER_INPUT_FOCUS_ID = 'navigation-drawer-input';
@@ -32,7 +31,6 @@ export const NavigationDrawerInput = ({
onSubmit,
onCancel,
onClickOutside,
- hotkeyScope,
}: NavigationDrawerInputProps) => {
const inputRef = useRef(null);
@@ -45,7 +43,6 @@ export const NavigationDrawerInput = ({
});
},
focusId: NAVIGATION_DRAWER_INPUT_FOCUS_ID,
- scope: hotkeyScope,
});
useHotkeysOnFocusedElement({
@@ -57,7 +54,6 @@ export const NavigationDrawerInput = ({
});
},
focusId: NAVIGATION_DRAWER_INPUT_FOCUS_ID,
- scope: hotkeyScope,
});
useListenClickOutside({
@@ -86,7 +82,9 @@ export const NavigationDrawerInput = ({
type: FocusComponentType.TEXT_INPUT,
instanceId: NAVIGATION_DRAWER_INPUT_FOCUS_ID,
},
- hotkeyScope: { scope: hotkeyScope },
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
+ },
});
};
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/types/NavigationDrawerHotKeyScope.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/types/NavigationDrawerHotKeyScope.ts
deleted file mode 100644
index 834b5d50e..000000000
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/types/NavigationDrawerHotKeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum NavigationDrawerHotKeyScope {
- MultiWorkspaceDropdownButton = 'multi-workspace-dropdown',
-}
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/constants/DebugFocusStack.ts b/packages/twenty-front/src/modules/ui/utilities/focus/constants/DebugFocusStack.ts
index 0239aa703..687ba830b 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/constants/DebugFocusStack.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/constants/DebugFocusStack.ts
@@ -1,3 +1 @@
-import { DEBUG_HOTKEY_SCOPE } from '@/ui/utilities/hotkey/constants/DebugHotkeyScope';
-
-export const DEBUG_FOCUS_STACK = DEBUG_HOTKEY_SCOPE;
+export const DEBUG_FOCUS_STACK = false;
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/usePushFocusItemToFocusStack.test.tsx b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/usePushFocusItemToFocusStack.test.tsx
index 1f15da1fc..5ce2d2512 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/usePushFocusItemToFocusStack.test.tsx
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/usePushFocusItemToFocusStack.test.tsx
@@ -43,7 +43,6 @@ describe('usePushFocusItemToFocusStack', () => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
};
await act(async () => {
@@ -53,8 +52,6 @@ describe('usePushFocusItemToFocusStack', () => {
type: focusItem.componentInstance.componentType,
instanceId: focusItem.componentInstance.componentInstanceId,
},
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: 'global',
});
});
@@ -71,7 +68,6 @@ describe('usePushFocusItemToFocusStack', () => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
};
await act(async () => {
@@ -81,8 +77,6 @@ describe('usePushFocusItemToFocusStack', () => {
type: anotherFocusItem.componentInstance.componentType,
instanceId: anotherFocusItem.componentInstance.componentInstanceId,
},
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: 'global',
});
});
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useRemoveFocusItemFromFocusStackById.test.tsx b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useRemoveFocusItemFromFocusStackById.test.tsx
index 61cefc7f0..9cff6e11d 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useRemoveFocusItemFromFocusStackById.test.tsx
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useRemoveFocusItemFromFocusStackById.test.tsx
@@ -41,7 +41,6 @@ const firstFocusItem = {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
};
const secondFocusItem = {
@@ -54,7 +53,6 @@ const secondFocusItem = {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
};
describe('useRemoveFocusItemFromFocusStackById', () => {
@@ -68,8 +66,6 @@ describe('useRemoveFocusItemFromFocusStackById', () => {
type: firstFocusItem.componentInstance.componentType,
instanceId: firstFocusItem.componentInstance.componentInstanceId,
},
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: firstFocusItem.memoizeKey,
});
});
@@ -80,8 +76,6 @@ describe('useRemoveFocusItemFromFocusStackById', () => {
type: secondFocusItem.componentInstance.componentType,
instanceId: secondFocusItem.componentInstance.componentInstanceId,
},
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: secondFocusItem.memoizeKey,
});
});
@@ -111,8 +105,6 @@ describe('useRemoveFocusItemFromFocusStackById', () => {
type: firstFocusItem.componentInstance.componentType,
instanceId: firstFocusItem.componentInstance.componentInstanceId,
},
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: 'global',
});
});
@@ -123,8 +115,6 @@ describe('useRemoveFocusItemFromFocusStackById', () => {
type: secondFocusItem.componentInstance.componentType,
instanceId: secondFocusItem.componentInstance.componentInstanceId,
},
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: 'global',
});
});
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStack.test.tsx b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStack.test.tsx
index 8a63c41e0..2b06db69b 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStack.test.tsx
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStack.test.tsx
@@ -44,7 +44,6 @@ describe('useResetFocusStack', () => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
};
await act(async () => {
@@ -54,8 +53,6 @@ describe('useResetFocusStack', () => {
type: focusItem.componentInstance.componentType,
instanceId: focusItem.componentInstance.componentInstanceId,
},
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: 'global',
});
});
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStackToFocusItem.test.tsx b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStackToFocusItem.test.tsx
index e956b208c..08209626d 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStackToFocusItem.test.tsx
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStackToFocusItem.test.tsx
@@ -44,7 +44,6 @@ describe('useResetFocusStackToFocusItem', () => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
};
const secondFocusItem = {
@@ -57,7 +56,6 @@ describe('useResetFocusStackToFocusItem', () => {
enableGlobalHotkeysWithModifiers: true,
enableGlobalHotkeysConflictingWithKeyboard: true,
},
- memoizeKey: 'global',
};
await act(async () => {
@@ -67,8 +65,6 @@ describe('useResetFocusStackToFocusItem', () => {
type: firstFocusItem.componentInstance.componentType,
instanceId: firstFocusItem.componentInstance.componentInstanceId,
},
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: firstFocusItem.memoizeKey,
});
});
@@ -79,8 +75,6 @@ describe('useResetFocusStackToFocusItem', () => {
type: secondFocusItem.componentInstance.componentType,
instanceId: secondFocusItem.componentInstance.componentInstanceId,
},
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: secondFocusItem.memoizeKey,
});
});
@@ -93,8 +87,6 @@ describe('useResetFocusStackToFocusItem', () => {
await act(async () => {
result.current.resetFocusStackToFocusItem({
focusStackItem: firstFocusItem,
- hotkeyScope: { scope: 'test-scope' },
- memoizeKey: firstFocusItem.memoizeKey,
});
});
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/usePushFocusItemToFocusStack.ts b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/usePushFocusItemToFocusStack.ts
index 3453cefb3..52a00a077 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/usePushFocusItemToFocusStack.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/usePushFocusItemToFocusStack.ts
@@ -2,9 +2,7 @@ import { DEBUG_FOCUS_STACK } from '@/ui/utilities/focus/constants/DebugFocusStac
import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { FocusStackItem } from '@/ui/utilities/focus/types/FocusStackItem';
-import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { GlobalHotkeysConfig } from '@/ui/utilities/hotkey/types/GlobalHotkeysConfig';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { useRecoilCallback } from 'recoil';
import { logDebug } from '~/utils/logDebug';
@@ -23,15 +21,11 @@ const addOrMoveItemToTheTopOfTheStack = ({
];
export const usePushFocusItemToFocusStack = () => {
- const { setHotkeyScopeAndMemorizePreviousScope } = usePreviousHotkeyScope();
-
const pushFocusItemToFocusStack = useRecoilCallback(
({ snapshot, set }) =>
({
focusId,
component,
- hotkeyScope,
- memoizeKey = 'global',
globalHotkeysConfig,
}: {
focusId: string;
@@ -40,9 +34,6 @@ export const usePushFocusItemToFocusStack = () => {
instanceId: string;
};
globalHotkeysConfig?: Partial;
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- hotkeyScope: HotkeyScope;
- memoizeKey?: string;
}) => {
const focusStackItem: FocusStackItem = {
focusId,
@@ -57,8 +48,6 @@ export const usePushFocusItemToFocusStack = () => {
globalHotkeysConfig?.enableGlobalHotkeysConflictingWithKeyboard ??
true,
},
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- memoizeKey,
};
const currentFocusStack = snapshot
@@ -78,15 +67,8 @@ export const usePushFocusItemToFocusStack = () => {
newFocusStack,
});
}
-
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- setHotkeyScopeAndMemorizePreviousScope({
- scope: hotkeyScope.scope,
- customScopes: hotkeyScope.customScopes,
- memoizeKey,
- });
},
- [setHotkeyScopeAndMemorizePreviousScope],
+ [],
);
return { pushFocusItemToFocusStack };
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackByComponentType.ts b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackByComponentType.ts
index 7fe2863f2..682ad11b5 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackByComponentType.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackByComponentType.ts
@@ -1,13 +1,10 @@
import { DEBUG_FOCUS_STACK } from '@/ui/utilities/focus/constants/DebugFocusStack';
import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
-import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { useRecoilCallback } from 'recoil';
import { logDebug } from '~/utils/logDebug';
export const useRemoveLastFocusItemFromFocusStackByComponentType = () => {
- const { goBackToPreviousHotkeyScope } = usePreviousHotkeyScope();
-
const removeLastFocusItemFromFocusStackByComponentType = useRecoilCallback(
({ snapshot, set }) =>
({ componentType }: { componentType: FocusComponentType }) => {
@@ -44,11 +41,8 @@ export const useRemoveLastFocusItemFromFocusStackByComponentType = () => {
},
);
}
-
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- goBackToPreviousHotkeyScope(removedFocusItem.memoizeKey);
},
- [goBackToPreviousHotkeyScope],
+ [],
);
return { removeLastFocusItemFromFocusStackByComponentType };
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById.ts b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById.ts
index 37a9ddffb..8e9520860 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById.ts
@@ -1,12 +1,9 @@
import { DEBUG_FOCUS_STACK } from '@/ui/utilities/focus/constants/DebugFocusStack';
import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';
-import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { useRecoilCallback } from 'recoil';
import { logDebug } from '~/utils/logDebug';
export const useRemoveFocusItemFromFocusStackById = () => {
- const { goBackToPreviousHotkeyScope } = usePreviousHotkeyScope();
-
const removeFocusItemFromFocusStackById = useRecoilCallback(
({ snapshot, set }) =>
({ focusId }: { focusId: string }) => {
@@ -31,11 +28,8 @@ export const useRemoveFocusItemFromFocusStackById = () => {
newFocusStack,
});
}
-
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- goBackToPreviousHotkeyScope(removedFocusItem.memoizeKey);
},
- [goBackToPreviousHotkeyScope],
+ [],
);
return { removeFocusItemFromFocusStackById };
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useResetFocusStack.ts b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useResetFocusStack.ts
index c2728ff9d..5514ebc6b 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useResetFocusStack.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useResetFocusStack.ts
@@ -1,23 +1,17 @@
import { DEBUG_FOCUS_STACK } from '@/ui/utilities/focus/constants/DebugFocusStack';
import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';
-import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';
-import { previousHotkeyScopeFamilyState } from '@/ui/utilities/hotkey/states/internal/previousHotkeyScopeFamilyState';
import { useRecoilCallback } from 'recoil';
import { logDebug } from '~/utils/logDebug';
export const useResetFocusStack = () => {
const resetFocusStack = useRecoilCallback(
({ reset }) =>
- (memoizeKey = 'global') => {
+ () => {
reset(focusStackState);
if (DEBUG_FOCUS_STACK) {
logDebug(`DEBUG: reset focus stack`);
}
-
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- reset(previousHotkeyScopeFamilyState(memoizeKey as string));
- reset(currentHotkeyScopeState);
},
[],
);
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useResetFocusStackToFocusItem.ts b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useResetFocusStackToFocusItem.ts
index 3c541f9fe..8e1fe02c4 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useResetFocusStackToFocusItem.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/useResetFocusStackToFocusItem.ts
@@ -1,26 +1,13 @@
import { DEBUG_FOCUS_STACK } from '@/ui/utilities/focus/constants/DebugFocusStack';
import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';
import { FocusStackItem } from '@/ui/utilities/focus/types/FocusStackItem';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
-import { previousHotkeyScopeFamilyState } from '@/ui/utilities/hotkey/states/internal/previousHotkeyScopeFamilyState';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { useRecoilCallback } from 'recoil';
import { logDebug } from '~/utils/logDebug';
export const useResetFocusStackToFocusItem = () => {
- const setHotkeyScope = useSetHotkeyScope();
-
const resetFocusStackToFocusItem = useRecoilCallback(
({ set }) =>
- ({
- focusStackItem,
- hotkeyScope,
- memoizeKey = 'global',
- }: {
- focusStackItem: FocusStackItem;
- hotkeyScope: HotkeyScope;
- memoizeKey?: string;
- }) => {
+ ({ focusStackItem }: { focusStackItem: FocusStackItem }) => {
set(focusStackState, [focusStackItem]);
if (DEBUG_FOCUS_STACK) {
@@ -28,12 +15,8 @@ export const useResetFocusStackToFocusItem = () => {
focusStackItem,
});
}
-
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- set(previousHotkeyScopeFamilyState(memoizeKey), null);
- setHotkeyScope(hotkeyScope.scope, hotkeyScope.customScopes);
},
- [setHotkeyScope],
+ [],
);
return { resetFocusStackToFocusItem };
diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/types/FocusStackItem.ts b/packages/twenty-front/src/modules/ui/utilities/focus/types/FocusStackItem.ts
index e6f866901..262547f39 100644
--- a/packages/twenty-front/src/modules/ui/utilities/focus/types/FocusStackItem.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/focus/types/FocusStackItem.ts
@@ -5,5 +5,4 @@ export type FocusStackItem = {
focusId: string;
componentInstance: FocusComponentInstance;
globalHotkeysConfig: GlobalHotkeysConfig;
- memoizeKey: string;
};
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/components/HotkeyEffect.tsx b/packages/twenty-front/src/modules/ui/utilities/hotkey/components/HotkeyEffect.tsx
index 28dd767e8..f40910f10 100644
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/components/HotkeyEffect.tsx
+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/components/HotkeyEffect.tsx
@@ -1,6 +1,5 @@
import { Keys } from 'react-hotkeys-hook';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
type HotkeyEffectProps = {
@@ -20,7 +19,6 @@ export const HotkeyEffect = ({
keys: hotkey.key,
callback: onHotkeyTriggered,
focusId,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [onHotkeyTriggered],
});
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/constants/DebugHotkeyScope.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/constants/DebugHotkeyScope.ts
deleted file mode 100644
index 0ac5ab524..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/constants/DebugHotkeyScope.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const DEBUG_HOTKEY_SCOPE = false;
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/constants/DefaultHotkeysScopeCustomScopes.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/constants/DefaultHotkeysScopeCustomScopes.ts
deleted file mode 100644
index 754e8fc34..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/constants/DefaultHotkeysScopeCustomScopes.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { CustomHotkeyScopes } from '@/ui/utilities/hotkey/types/CustomHotkeyScope';
-
-export const DEFAULT_HOTKEYS_SCOPE_CUSTOM_SCOPES: CustomHotkeyScopes = {
- commandMenu: true,
- goto: false,
- keyboardShortcutMenu: false,
-};
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/constants/InitialHotkeysScope.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/constants/InitialHotkeysScope.ts
deleted file mode 100644
index bc4f1c371..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/constants/InitialHotkeysScope.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { AppHotkeyScope } from '../types/AppHotkeyScope';
-import { HotkeyScope } from '../types/HotkeyScope';
-
-export const INITIAL_HOTKEYS_SCOPE: HotkeyScope = {
- scope: AppHotkeyScope.App,
- customScopes: {
- commandMenu: true,
- goto: true,
- keyboardShortcutMenu: true,
- },
-};
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/__tests__/useGoToHotkeys.test.tsx b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/__tests__/useGoToHotkeys.test.tsx
index 78cf9609c..b4de42707 100644
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/__tests__/useGoToHotkeys.test.tsx
+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/__tests__/useGoToHotkeys.test.tsx
@@ -2,9 +2,6 @@ import { act, fireEvent, renderHook } from '@testing-library/react';
import { MemoryRouter, useLocation } from 'react-router-dom';
import { RecoilRoot } from 'recoil';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
-
import { useGoToHotkeys } from '../useGoToHotkeys';
const Wrapper = ({ children }: { children: React.ReactNode }) => (
@@ -24,10 +21,6 @@ describe('useGoToHotkeys', () => {
const { result } = renderHook(() => {
useGoToHotkeys({ key: 'a', location: '/three' });
- const setHotkeyScope = useSetHotkeyScope();
-
- setHotkeyScope(AppHotkeyScope.App, { goto: true });
-
const location = useLocation();
return {
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeys.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeys.ts
index 4d97c51a5..5bcd9b7f5 100644
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeys.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeys.ts
@@ -11,8 +11,6 @@ export const useGlobalHotkeys = (
keys: Keys,
callback: HotkeyCallback,
containsModifier: boolean,
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- scope: string,
dependencies?: unknown[],
options?: UseHotkeysOptionsWithoutBuggyOptions,
) => {
@@ -59,7 +57,6 @@ export const useGlobalHotkeys = (
callback: () => {
handleCallback(keyboardEvent, hotkeysEvent);
},
- scope,
preventDefault,
containsModifier,
});
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysCallback.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysCallback.ts
index 23c9fbb5b..4c851d291 100644
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysCallback.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysCallback.ts
@@ -1,12 +1,11 @@
+import { DEBUG_FOCUS_STACK } from '@/ui/utilities/focus/constants/DebugFocusStack';
import { currentGlobalHotkeysConfigSelector } from '@/ui/utilities/focus/states/currentGlobalHotkeysConfigSelector';
-import { internalHotkeysEnabledScopesState } from '@/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState';
import {
Hotkey,
OptionsOrDependencyArray,
} from 'react-hotkeys-hook/dist/types';
import { useRecoilCallback } from 'recoil';
import { logDebug } from '~/utils/logDebug';
-import { DEBUG_HOTKEY_SCOPE } from '../constants/DebugHotkeyScope';
export const useGlobalHotkeysCallback = (
dependencies?: OptionsOrDependencyArray,
@@ -21,20 +20,13 @@ export const useGlobalHotkeysCallback = (
hotkeysEvent,
keyboardEvent,
preventDefault,
- scope,
}: {
keyboardEvent: KeyboardEvent;
hotkeysEvent: Hotkey;
containsModifier: boolean;
callback: (keyboardEvent: KeyboardEvent, hotkeysEvent: Hotkey) => void;
preventDefault?: boolean;
- scope: string;
}) => {
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- const currentHotkeyScopes = snapshot
- .getLoadable(internalHotkeysEnabledScopesState)
- .getValue();
-
const currentGlobalHotkeysConfig = snapshot
.getLoadable(currentGlobalHotkeysConfigSelector)
.getValue();
@@ -43,7 +35,7 @@ export const useGlobalHotkeysCallback = (
containsModifier &&
!currentGlobalHotkeysConfig.enableGlobalHotkeysWithModifiers
) {
- if (DEBUG_HOTKEY_SCOPE) {
+ if (DEBUG_FOCUS_STACK) {
logDebug(
`DEBUG: %cI can't call hotkey (${
hotkeysEvent.keys
@@ -59,7 +51,7 @@ export const useGlobalHotkeysCallback = (
!containsModifier &&
!currentGlobalHotkeysConfig.enableGlobalHotkeysConflictingWithKeyboard
) {
- if (DEBUG_HOTKEY_SCOPE) {
+ if (DEBUG_FOCUS_STACK) {
logDebug(
`DEBUG: %cI can't call hotkey (${
hotkeysEvent.keys
@@ -70,36 +62,8 @@ export const useGlobalHotkeysCallback = (
return;
}
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- if (!currentHotkeyScopes.includes(scope)) {
- if (DEBUG_HOTKEY_SCOPE) {
- logDebug(
- `DEBUG: %cI can't call hotkey (${
- hotkeysEvent.keys
- }) because I'm in scope [${scope}] and the active scopes are : [${currentHotkeyScopes.join(
- ', ',
- )}]`,
- 'color: gray; ',
- );
- }
-
- return;
- }
-
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- if (DEBUG_HOTKEY_SCOPE) {
- logDebug(
- `DEBUG: %cI can call hotkey (${
- hotkeysEvent.keys
- }) because I'm in scope [${scope}] and the active scopes are : [${currentHotkeyScopes.join(
- ', ',
- )}]`,
- 'color: green;',
- );
- }
-
if (preventDefault === true) {
- if (DEBUG_HOTKEY_SCOPE) {
+ if (DEBUG_FOCUS_STACK) {
logDebug(
`DEBUG: %cI prevent default for hotkey (${hotkeysEvent.keys})`,
'color: gray;',
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysSequence.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysSequence.ts
index 10565ce04..fee92c0e1 100644
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysSequence.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysSequence.ts
@@ -11,7 +11,6 @@ export const useGlobalHotkeysSequence = (
firstKey: Keys,
secondKey: Keys,
sequenceCallback: () => void,
- scope: string,
options: Options = {
enableOnContentEditable: true,
enableOnFormTags: true,
@@ -33,7 +32,6 @@ export const useGlobalHotkeysSequence = (
callback: () => {
setPendingHotkey(firstKey);
},
- scope,
preventDefault: !!options.preventDefault,
});
},
@@ -41,7 +39,7 @@ export const useGlobalHotkeysSequence = (
enableOnContentEditable: options.enableOnContentEditable,
enableOnFormTags: options.enableOnFormTags,
},
- [setPendingHotkey, scope],
+ [setPendingHotkey],
);
useHotkeys(
@@ -66,7 +64,6 @@ export const useGlobalHotkeysSequence = (
sequenceCallback();
},
- scope,
preventDefault: false,
});
},
@@ -74,6 +71,6 @@ export const useGlobalHotkeysSequence = (
enableOnContentEditable: options.enableOnContentEditable,
enableOnFormTags: options.enableOnFormTags,
},
- [pendingHotkey, setPendingHotkey, scope, ...deps],
+ [pendingHotkey, setPendingHotkey, ...deps],
);
};
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGoToHotkeys.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGoToHotkeys.ts
index 46ca5b869..7ce15afa0 100644
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGoToHotkeys.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGoToHotkeys.ts
@@ -2,7 +2,6 @@ import { Keys } from 'react-hotkeys-hook/dist/types';
import { useNavigate } from 'react-router-dom';
import { useGlobalHotkeysSequence } from '@/ui/utilities/hotkey/hooks/useGlobalHotkeysSequence';
-import { AppHotkeyScope } from '../types/AppHotkeyScope';
type GoToHotkeysProps = {
key: Keys;
@@ -24,7 +23,6 @@ export const useGoToHotkeys = ({
preNavigateFunction?.();
navigate(location);
},
- AppHotkeyScope.Goto,
{
enableOnContentEditable: true,
enableOnFormTags: true,
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement.ts
index 562de2617..a1f9d6190 100644
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement.ts
@@ -11,16 +11,12 @@ export const useHotkeysOnFocusedElement = ({
keys,
callback,
focusId,
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- scope,
dependencies,
options,
}: {
keys: Keys;
callback: HotkeyCallback;
focusId: string;
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- scope: string;
dependencies?: unknown[];
options?: UseHotkeysOptionsWithoutBuggyOptions;
}) => {
@@ -59,7 +55,6 @@ export const useHotkeysOnFocusedElement = ({
setPendingHotkey(null);
},
focusId,
- scope,
preventDefault,
});
},
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElementCallback.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElementCallback.ts
index 30aca7199..fb2ba199a 100644
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElementCallback.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElementCallback.ts
@@ -1,4 +1,4 @@
-import { internalHotkeysEnabledScopesState } from '@/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState';
+import { DEBUG_FOCUS_STACK } from '@/ui/utilities/focus/constants/DebugFocusStack';
import {
Hotkey,
OptionsOrDependencyArray,
@@ -6,7 +6,6 @@ import {
import { useRecoilCallback } from 'recoil';
import { logDebug } from '~/utils/logDebug';
import { currentFocusIdSelector } from '../../focus/states/currentFocusIdSelector';
-import { DEBUG_HOTKEY_SCOPE } from '../constants/DebugHotkeyScope';
export const useHotkeysOnFocusedElementCallback = (
dependencies?: OptionsOrDependencyArray,
@@ -20,36 +19,24 @@ export const useHotkeysOnFocusedElementCallback = (
hotkeysEvent,
keyboardEvent,
focusId,
- scope,
preventDefault,
}: {
keyboardEvent: KeyboardEvent;
hotkeysEvent: Hotkey;
callback: (keyboardEvent: KeyboardEvent, hotkeysEvent: Hotkey) => void;
focusId: string;
- scope: string;
preventDefault?: boolean;
}) => {
const currentFocusId = snapshot
.getLoadable(currentFocusIdSelector)
.getValue();
- // TODO: Remove this once we've migrated hotkey scopes to the new api
- const currentHotkeyScopes = snapshot
- .getLoadable(internalHotkeysEnabledScopesState)
- .getValue();
-
- if (
- currentFocusId !== focusId ||
- !currentHotkeyScopes.includes(scope)
- ) {
- if (DEBUG_HOTKEY_SCOPE) {
+ if (currentFocusId !== focusId) {
+ if (DEBUG_FOCUS_STACK) {
logDebug(
`DEBUG: %cI can't call hotkey (${
hotkeysEvent.keys
- }) because I'm in scope [${scope}] and the active scopes are : [${currentHotkeyScopes.join(
- ', ',
- )}] and the current focus identifier is [${currentFocusId}], and the focusId is [${focusId}]`,
+ }) because I'm in [${focusId}] and the current focus identifier is [${currentFocusId}]`,
'color: gray; ',
);
}
@@ -57,19 +44,17 @@ export const useHotkeysOnFocusedElementCallback = (
return;
}
- if (DEBUG_HOTKEY_SCOPE) {
+ if (DEBUG_FOCUS_STACK) {
logDebug(
`DEBUG: %cI can call hotkey (${
hotkeysEvent.keys
- }) because I'm in scope [${scope}] and the active scopes are : [${currentHotkeyScopes.join(
- ', ',
- )}], and the current focus identifier is [${currentFocusId}], and the focusId is [${focusId}]`,
+ }) because I'm in [${focusId}] and the current focus identifier is [${currentFocusId}]`,
'color: green;',
);
}
if (preventDefault === true) {
- if (DEBUG_HOTKEY_SCOPE) {
+ if (DEBUG_FOCUS_STACK) {
logDebug(
`DEBUG: %cI prevent default for hotkey (${hotkeysEvent.keys})`,
'color: gray;',
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/usePreviousHotkeyScope.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/usePreviousHotkeyScope.ts
deleted file mode 100644
index 6268fa260..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/usePreviousHotkeyScope.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import { useRecoilCallback } from 'recoil';
-
-import { logDebug } from '~/utils/logDebug';
-import { DEBUG_HOTKEY_SCOPE } from '../constants/DebugHotkeyScope';
-
-import { currentHotkeyScopeState } from '../states/internal/currentHotkeyScopeState';
-import { previousHotkeyScopeFamilyState } from '../states/internal/previousHotkeyScopeFamilyState';
-import { CustomHotkeyScopes } from '../types/CustomHotkeyScope';
-
-import { useSetHotkeyScope } from './useSetHotkeyScope';
-
-export const usePreviousHotkeyScope = () => {
- const setHotkeyScope = useSetHotkeyScope();
-
- const goBackToPreviousHotkeyScope = useRecoilCallback(
- ({ snapshot, set }) =>
- (memoizeKey = 'global') => {
- const previousHotkeyScope = snapshot
- .getLoadable(previousHotkeyScopeFamilyState(memoizeKey as string))
- .getValue();
-
- if (!previousHotkeyScope) {
- if (DEBUG_HOTKEY_SCOPE) {
- logDebug(`DEBUG: no previous hotkey scope ${memoizeKey}`);
- }
-
- return;
- }
-
- if (DEBUG_HOTKEY_SCOPE) {
- logDebug(
- `DEBUG: goBackToPreviousHotkeyScope ${previousHotkeyScope.scope}`,
- previousHotkeyScope,
- );
- }
-
- setHotkeyScope(
- previousHotkeyScope.scope,
- previousHotkeyScope.customScopes,
- );
-
- set(previousHotkeyScopeFamilyState(memoizeKey as string), null);
- },
- [setHotkeyScope],
- );
-
- const setHotkeyScopeAndMemorizePreviousScope = useRecoilCallback(
- ({ snapshot, set }) =>
- ({
- scope,
- customScopes,
- memoizeKey = 'global',
- }: {
- scope: string;
- customScopes?: CustomHotkeyScopes;
- memoizeKey?: string;
- }) => {
- const currentHotkeyScope = snapshot
- .getLoadable(currentHotkeyScopeState)
- .getValue();
-
- if (DEBUG_HOTKEY_SCOPE) {
- logDebug('DEBUG: setHotkeyScopeAndMemorizePreviousScope', {
- currentHotkeyScope,
- scope,
- customScopes,
- });
- }
-
- setHotkeyScope(scope, customScopes);
-
- set(previousHotkeyScopeFamilyState(memoizeKey), currentHotkeyScope);
- },
- [setHotkeyScope],
- );
-
- return {
- setHotkeyScopeAndMemorizePreviousScope,
- goBackToPreviousHotkeyScope,
- };
-};
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useSetHotkeyScope.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useSetHotkeyScope.ts
deleted file mode 100644
index 42bbe3a14..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useSetHotkeyScope.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-import { useRecoilCallback } from 'recoil';
-
-import { DEBUG_HOTKEY_SCOPE } from '../constants/DebugHotkeyScope';
-
-import { isDefined } from 'twenty-shared/utils';
-import { logDebug } from '~/utils/logDebug';
-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';
-
-const areCustomScopesEqual = (
- customScopesA: CustomHotkeyScopes | undefined,
- customScopesB: CustomHotkeyScopes | undefined,
-) => {
- return (
- customScopesA?.commandMenu === customScopesB?.commandMenu &&
- customScopesA?.commandMenuOpen === customScopesB?.commandMenuOpen &&
- customScopesA?.goto === customScopesB?.goto &&
- customScopesA?.keyboardShortcutMenu ===
- customScopesB?.keyboardShortcutMenu &&
- customScopesA?.searchRecords === customScopesB?.searchRecords
- );
-};
-
-export const useSetHotkeyScope = () =>
- useRecoilCallback(
- ({ snapshot, set }) =>
- async (hotkeyScopeToSet: string, customScopes?: CustomHotkeyScopes) => {
- const currentHotkeyScope = snapshot
- .getLoadable(currentHotkeyScopeState)
- .getValue();
-
- if (currentHotkeyScope.scope === hotkeyScopeToSet) {
- if (!isDefined(customScopes)) {
- if (
- areCustomScopesEqual(
- currentHotkeyScope?.customScopes,
- DEFAULT_HOTKEYS_SCOPE_CUSTOM_SCOPES,
- )
- ) {
- return;
- }
- } else {
- if (
- areCustomScopesEqual(
- currentHotkeyScope?.customScopes,
- customScopes,
- )
- ) {
- return;
- }
- }
- }
-
- const newHotkeyScope: HotkeyScope = {
- scope: hotkeyScopeToSet,
- customScopes: {
- commandMenu: customScopes?.commandMenu ?? true,
- commandMenuOpen: customScopes?.commandMenuOpen ?? true,
- goto: customScopes?.goto ?? false,
- keyboardShortcutMenu: customScopes?.keyboardShortcutMenu ?? false,
- searchRecords: customScopes?.searchRecords ?? false,
- },
- };
-
- const scopesToSet: string[] = [];
-
- if (newHotkeyScope.customScopes?.commandMenu === true) {
- scopesToSet.push(AppHotkeyScope.CommandMenu);
- }
-
- if (newHotkeyScope.customScopes?.commandMenuOpen === true) {
- scopesToSet.push(AppHotkeyScope.CommandMenuOpen);
- }
-
- if (newHotkeyScope?.customScopes?.goto === true) {
- scopesToSet.push(AppHotkeyScope.Goto);
- }
-
- if (newHotkeyScope?.customScopes?.keyboardShortcutMenu === true) {
- scopesToSet.push(AppHotkeyScope.KeyboardShortcutMenu);
- }
-
- if (newHotkeyScope?.customScopes?.searchRecords === true) {
- scopesToSet.push(AppHotkeyScope.SearchRecords);
- }
-
- scopesToSet.push(newHotkeyScope.scope);
-
- if (DEBUG_HOTKEY_SCOPE) {
- logDebug(`DEBUG: set new hotkey scope : ${newHotkeyScope.scope}`, {
- scopesToSet,
- newHotkeyScope,
- });
- }
-
- set(internalHotkeysEnabledScopesState, scopesToSet);
- set(currentHotkeyScopeState, newHotkeyScope);
- },
- [],
- );
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/currentHotkeyScopeState.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/currentHotkeyScopeState.ts
deleted file mode 100644
index 900af17f0..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/currentHotkeyScopeState.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { createState } from 'twenty-ui/utilities';
-import { INITIAL_HOTKEYS_SCOPE } from '../../constants/InitialHotkeysScope';
-import { HotkeyScope } from '../../types/HotkeyScope';
-
-export const currentHotkeyScopeState = createState({
- key: 'currentHotkeyScopeState',
- defaultValue: INITIAL_HOTKEYS_SCOPE,
-});
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState.ts
deleted file mode 100644
index 93e9e3496..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { createState } from 'twenty-ui/utilities';
-export const internalHotkeysEnabledScopesState = createState({
- key: 'internalHotkeysEnabledScopesState',
- defaultValue: [],
-});
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/previousHotkeyScopeFamilyState.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/previousHotkeyScopeFamilyState.ts
deleted file mode 100644
index 821edf41c..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/previousHotkeyScopeFamilyState.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { createFamilyState } from '@/ui/utilities/state/utils/createFamilyState';
-
-import { HotkeyScope } from '../../types/HotkeyScope';
-
-export const previousHotkeyScopeFamilyState = createFamilyState<
- HotkeyScope | null,
- string
->({
- key: 'previousHotkeyScopeFamilyState',
- defaultValue: null,
-});
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/types/AppHotkeyScope.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/types/AppHotkeyScope.ts
deleted file mode 100644
index 60e7d9d92..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/types/AppHotkeyScope.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export enum AppHotkeyScope {
- App = 'app',
- Goto = 'goto',
- CommandMenu = 'command-menu',
- CommandMenuOpen = 'command-menu-open',
- SearchRecords = 'search-records',
- KeyboardShortcutMenu = 'keyboard-shortcut-menu',
- KeyboardShortcutMenuOpen = 'keyboard-shortcut-menu-open',
-}
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/types/CustomHotkeyScope.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/types/CustomHotkeyScope.ts
deleted file mode 100644
index 49d02d2a6..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/types/CustomHotkeyScope.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export type CustomHotkeyScopes = {
- goto?: boolean;
- commandMenu?: boolean;
- commandMenuOpen?: boolean;
- keyboardShortcutMenu?: boolean;
- searchRecords?: boolean;
-};
diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/types/HotkeyScope.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/types/HotkeyScope.ts
deleted file mode 100644
index 1b430e453..000000000
--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/types/HotkeyScope.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { CustomHotkeyScopes } from './CustomHotkeyScope';
-
-export type HotkeyScope = {
- scope: string;
- customScopes?: CustomHotkeyScopes;
-};
diff --git a/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx b/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx
index e0af55c4e..879e5a3f7 100644
--- a/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx
+++ b/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx
@@ -6,7 +6,6 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
import { UPDATE_VIEW_BUTTON_DROPDOWN_ID } from '@/views/constants/UpdateViewButtonDropdownId';
@@ -31,10 +30,6 @@ const StyledContainer = styled.div`
position: relative;
`;
-export type UpdateViewButtonGroupProps = {
- hotkeyScope: HotkeyScope;
-};
-
export const UpdateViewButtonGroup = () => {
const { saveCurrentViewFilterAndSorts } = useSaveCurrentViewFiltersAndSorts();
diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenu.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenu.tsx
index 20d1d632f..9c82c9b95 100644
--- a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenu.tsx
+++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenu.tsx
@@ -16,7 +16,6 @@ import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/
import { ViewBarFilterDropdownBottomMenu } from '@/views/components/ViewBarFilterDropdownBottomMenu';
import { ViewBarFilterDropdownFieldSelectMenuItem } from '@/views/components/ViewBarFilterDropdownFieldSelectMenuItem';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
import { VIEW_BAR_FILTER_BOTTOM_MENU_ITEM_IDS } from '@/views/constants/ViewBarFilterBottomMenuItemIds';
import { VIEW_BAR_FILTER_DROPDOWN_ID } from '@/views/constants/ViewBarFilterDropdownId';
@@ -96,7 +95,6 @@ export const ViewBarFilterDropdownFieldSelectMenu = () => {
selectableItemIdArray={selectableFieldMetadataItemIds}
selectableListInstanceId={FILTER_FIELD_LIST_ID}
focusId={VIEW_BAR_FILTER_DROPDOWN_ID}
- hotkeyScope={DropdownHotkeyScope.Dropdown}
>
{shouldShowVisibleFields && (
<>
diff --git a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx
index 3a0f1cf07..88b8b9932 100644
--- a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx
+++ b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx
@@ -144,11 +144,6 @@ const meta: Meta = {
IconsProviderDecorator,
I18nFrontDecorator,
],
- args: {
- hotkeyScope: {
- scope: 'view-bar-filter-dropdown',
- },
- },
};
export default meta;
diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.test.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.test.test.tsx
index 3cd5a8841..b00ca2668 100644
--- a/packages/twenty-front/src/modules/views/hooks/__tests__/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.test.test.tsx
+++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.test.test.tsx
@@ -15,7 +15,6 @@ import { RecordFiltersComponentInstanceContext } from '@/object-record/record-fi
import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState';
import { RecordFilter } from '@/object-record/record-filter/types/RecordFilter';
import { getRecordFilterOperands } from '@/object-record/record-filter/utils/getRecordFilterOperands';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
@@ -171,10 +170,9 @@ describe('useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown', () =
type: FocusComponentType.DROPDOWN,
instanceId: personCompanyFieldMetadataItemMock.id,
},
- hotkeyScope: {
- scope: DropdownHotkeyScope.Dropdown,
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: personCompanyFieldMetadataItemMock.id,
});
});
diff --git a/packages/twenty-front/src/modules/views/hooks/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.ts b/packages/twenty-front/src/modules/views/hooks/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.ts
index 62eb3f2d0..e355a31c5 100644
--- a/packages/twenty-front/src/modules/views/hooks/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.ts
+++ b/packages/twenty-front/src/modules/views/hooks/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.ts
@@ -10,7 +10,6 @@ import { RecordFilter } from '@/object-record/record-filter/types/RecordFilter';
import { findDuplicateRecordFilterInNonAdvancedRecordFilters } from '@/object-record/record-filter/utils/findDuplicateRecordFilterInNonAdvancedRecordFilters';
import { getDateFilterDisplayValue } from '@/object-record/record-filter/utils/getDateFilterDisplayValue';
import { getRecordFilterOperands } from '@/object-record/record-filter/utils/getRecordFilterOperands';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
@@ -74,10 +73,9 @@ export const useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown =
type: FocusComponentType.DROPDOWN,
instanceId: fieldMetadataItem.id,
},
- hotkeyScope: {
- scope: DropdownHotkeyScope.Dropdown,
+ globalHotkeysConfig: {
+ enableGlobalHotkeysConflictingWithKeyboard: false,
},
- memoizeKey: fieldMetadataItem.id,
});
}
diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentCreateMode.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentCreateMode.tsx
index 6f915f0ed..61b6d053f 100644
--- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentCreateMode.tsx
+++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentCreateMode.tsx
@@ -10,7 +10,6 @@ import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenu
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
@@ -99,7 +98,6 @@ export const ViewPickerContentCreateMode = () => {
await createViewFromCurrentState();
},
focusId: VIEW_PICKER_DROPDOWN_ID,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [
viewPickerIsPersisting,
createViewFromCurrentState,
diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEditMode.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEditMode.tsx
index d3183ae48..7717ec8d1 100644
--- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEditMode.tsx
+++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEditMode.tsx
@@ -7,7 +7,6 @@ import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenu
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
-import { DropdownHotkeyScope } from '@/ui/layout/dropdown/constants/DropdownHotkeyScope';
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
@@ -51,7 +50,6 @@ export const ViewPickerContentEditMode = () => {
await updateViewFromCurrentState();
},
focusId: VIEW_PICKER_DROPDOWN_ID,
- scope: DropdownHotkeyScope.Dropdown,
dependencies: [viewPickerIsPersisting, updateViewFromCurrentState],
});
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepHeader.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepHeader.tsx
index 1e1d11bf5..b6615ddad 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepHeader.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepHeader.tsx
@@ -107,7 +107,6 @@ export const WorkflowStepHeader = ({
value={title}
onChange={handleChange}
placeholder={headerType}
- hotkeyScope="workflow-step-title"
onEnter={saveTitle}
onEscape={() => {
setTitle(initialTitle);
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useAgentChat.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useAgentChat.ts
index 26da08ff8..f9e98b4df 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useAgentChat.ts
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useAgentChat.ts
@@ -1,4 +1,3 @@
-import { InputHotkeyScope } from '@/ui/input/types/InputHotkeyScope';
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
import { useState } from 'react';
import { useRecoilState } from 'recoil';
@@ -151,7 +150,6 @@ export const useAgentChat = (agentId: string) => {
}
},
focusId: `${agentId}-chat-input`,
- scope: InputHotkeyScope.TextInput,
dependencies: [agentChatInput, isLoading],
options: {
enableOnFormTags: true,
diff --git a/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx b/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx
index d407ac798..25fcecaf7 100644
--- a/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx
+++ b/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx
@@ -15,7 +15,6 @@ import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
import { useSetNextOnboardingStatus } from '@/onboarding/hooks/useSetNextOnboardingStatus';
import { ProfilePictureUploader } from '@/settings/profile/components/ProfilePictureUploader';
import { PageFocusId } from '@/types/PageFocusId';
-import { PageHotkeyScope } from '@/types/PageHotkeyScope';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { TextInputV2 } from '@/ui/input/components/TextInputV2';
import { Modal } from '@/ui/layout/modal/components/Modal';
@@ -157,13 +156,8 @@ export const CreateProfile = () => {
useHotkeysOnFocusedElement({
keys: Key.Enter,
- callback: () => {
- if (isEditingMode) {
- onSubmit(getValues());
- }
- },
+ callback: handleEnter,
focusId: PageFocusId.CreateProfile,
- scope: PageHotkeyScope.CreateProfile,
dependencies: [handleEnter],
});
diff --git a/packages/twenty-front/src/pages/onboarding/InviteTeam.tsx b/packages/twenty-front/src/pages/onboarding/InviteTeam.tsx
index 8114b8613..6b1d3e043 100644
--- a/packages/twenty-front/src/pages/onboarding/InviteTeam.tsx
+++ b/packages/twenty-front/src/pages/onboarding/InviteTeam.tsx
@@ -4,7 +4,6 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { calendarBookingPageIdState } from '@/client-config/states/calendarBookingPageIdState';
import { useSetNextOnboardingStatus } from '@/onboarding/hooks/useSetNextOnboardingStatus';
import { PageFocusId } from '@/types/PageFocusId';
-import { PageHotkeyScope } from '@/types/PageHotkeyScope';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { TextInputV2 } from '@/ui/input/components/TextInputV2';
import { Modal } from '@/ui/layout/modal/components/Modal';
@@ -168,7 +167,6 @@ export const InviteTeam = () => {
handleSubmit(onSubmit)();
},
focusId: PageFocusId.InviteTeam,
- scope: PageHotkeyScope.InviteTeam,
dependencies: [handleSubmit, onSubmit],
});
diff --git a/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx b/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx
index 2d8e15979..5fe970efb 100644
--- a/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx
+++ b/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx
@@ -8,7 +8,6 @@ import { SubTitle } from '@/auth/components/SubTitle';
import { Title } from '@/auth/components/Title';
import { OnboardingSyncEmailsSettingsCard } from '@/onboarding/components/OnboardingSyncEmailsSettingsCard';
import { useSetNextOnboardingStatus } from '@/onboarding/hooks/useSetNextOnboardingStatus';
-import { PageHotkeyScope } from '@/types/PageHotkeyScope';
import { isGoogleCalendarEnabledState } from '@/client-config/states/isGoogleCalendarEnabledState';
import { isGoogleMessagingEnabledState } from '@/client-config/states/isGoogleMessagingEnabledState';
@@ -102,7 +101,6 @@ export const SyncEmails = () => {
await continueWithoutSync();
},
focusId: PageFocusId.SyncEmail,
- scope: PageHotkeyScope.SyncEmail,
dependencies: [continueWithoutSync],
});
diff --git a/packages/twenty-front/src/testing/InitializeHotkeyStorybookHook.tsx b/packages/twenty-front/src/testing/InitializeHotkeyStorybookHook.tsx
deleted file mode 100644
index 71653b8e1..000000000
--- a/packages/twenty-front/src/testing/InitializeHotkeyStorybookHook.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useEffect } from 'react';
-
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
-
-export const InitializeHotkeyStorybookHookEffect = () => {
- const setHotkeyScope = useSetHotkeyScope();
-
- useEffect(() => {
- setHotkeyScope(AppHotkeyScope.App, {
- commandMenu: true,
- goto: false,
- keyboardShortcutMenu: false,
- });
- }, [setHotkeyScope]);
-
- return <>>;
-};