Skip to content

The open alternative to Salesforce, designed for AI.

Fix hotkey scope in settings (#12387)

Félix Malfaitc74d7fe9868c
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 793e315482b..b77097342b5 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 { PageHotkeyScope } from '@/types/PageHotkeyScope';
-import { SettingsPath } from '@/types/SettingsPath';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { isDefined } from 'twenty-shared/utils';
@@ -152,27 +151,12 @@ export const PageChangeEffect = () => {
break;
}
case isMatchingLocation(location, AppPath.RecordShowPage): {
- setHotkeyScope(PageHotkeyScope.CompanyShowPage, {
+ setHotkeyScope(PageHotkeyScope.RecordShowPage, {
goto: true,
keyboardShortcutMenu: true,
});
break;
}
- case isMatchingLocation(location, AppPath.OpportunitiesPage): {
- setHotkeyScope(PageHotkeyScope.OpportunitiesPage, {
- goto: true,
- keyboardShortcutMenu: true,
- });
- break;
- }
- case isMatchingLocation(location, AppPath.TasksPage): {
- setHotkeyScope(PageHotkeyScope.TaskPage, {
- goto: true,
- keyboardShortcutMenu: true,
- });
- break;
- }
-
case isMatchingLocation(location, AppPath.SignInUp): {
setHotkeyScope(PageHotkeyScope.SignInUp);
break;
@@ -201,47 +185,12 @@ export const PageChangeEffect = () => {
setHotkeyScope(PageHotkeyScope.PlanRequired);
break;
}
- case isMatchingLocation(
- location,
- SettingsPath.ProfilePage,
- AppBasePath.Settings,
- ): {
- setHotkeyScope(PageHotkeyScope.ProfilePage, {
- goto: true,
- keyboardShortcutMenu: true,
- });
- break;
- }
- case isMatchingLocation(
- location,
- SettingsPath.Domain,
- AppBasePath.Settings,
- ): {
- setHotkeyScope(PageHotkeyScope.Settings, {
- goto: false,
- keyboardShortcutMenu: true,
- });
- break;
- }
- case isMatchingLocation(
- location,
- SettingsPath.RestPlayground,
- AppBasePath.Settings,
- ): {
+ case location.pathname.startsWith(AppBasePath.Settings): {
setHotkeyScope(PageHotkeyScope.Settings, {
goto: false,
- keyboardShortcutMenu: true,
- });
- break;
- }
- case isMatchingLocation(
- location,
- SettingsPath.WorkspaceMembersPage,
- AppBasePath.Settings,
- ): {
- setHotkeyScope(PageHotkeyScope.WorkspaceMemberPage, {
- goto: true,
- keyboardShortcutMenu: true,
+ keyboardShortcutMenu: false,
+ commandMenu: false,
+ commandMenuOpen: false,
});
break;
}
diff --git a/packages/twenty-front/src/modules/types/PageHotkeyScope.ts b/packages/twenty-front/src/modules/types/PageHotkeyScope.ts
index 4cc759f52e4..88ff9499d32 100644
--- a/packages/twenty-front/src/modules/types/PageHotkeyScope.ts
+++ b/packages/twenty-front/src/modules/types/PageHotkeyScope.ts
@@ -6,13 +6,5 @@ export enum PageHotkeyScope {
InviteTeam = 'invite-team',
SyncEmail = 'sync-email',
PlanRequired = 'plan-required',
- ShowPage = 'show-page',
- PersonShowPage = 'person-show-page',
- CompanyShowPage = 'company-show-page',
- CompaniesPage = 'companies-page',
- PeoplePage = 'people-page',
- OpportunitiesPage = 'opportunities-page',
- ProfilePage = 'profile-page',
- WorkspaceMemberPage = 'workspace-member-page',
- TaskPage = 'task-page',
+ RecordShowPage = 'record-show-page',
}
diff --git a/packages/twenty-front/src/modules/ui/layout/hooks/__tests__/useShowAuthModal.test.tsx b/packages/twenty-front/src/modules/ui/layout/hooks/__tests__/useShowAuthModal.test.tsx
index 6cde9c538d2..4ca522994eb 100644
--- a/packages/twenty-front/src/modules/ui/layout/hooks/__tests__/useShowAuthModal.test.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/hooks/__tests__/useShowAuthModal.test.tsx
@@ -45,8 +45,6 @@ const testCases = [
{ loc: AppPath.PlanRequiredSuccess, res: true },
{ loc: AppPath.Index, res: false },
- { loc: AppPath.TasksPage, res: false },
- { loc: AppPath.OpportunitiesPage, res: false },
{ loc: AppPath.RecordIndexPage, res: false },
{ loc: AppPath.RecordShowPage, res: false },
{ loc: AppPath.SettingsCatchAll, res: false },