Fix hotkey scope in settings (#12387)

Too many conflicts on hotkey scopes (e.g. we still had the issue on the
graphql playground). Let's disable all shortcuts in settings.
This commit is contained in:
Félix Malfait
2025-05-30 16:45:33 +02:00
committed by GitHub
parent c7139cbc84
commit c74d7fe986
3 changed files with 6 additions and 67 deletions

View File

@ -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,
): {
case location.pathname.startsWith(AppBasePath.Settings): {
setHotkeyScope(PageHotkeyScope.Settings, {
goto: false,
keyboardShortcutMenu: true,
});
break;
}
case isMatchingLocation(
location,
SettingsPath.RestPlayground,
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;
}

View File

@ -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',
}

View File

@ -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 },