685 Move all navigation actions inside the actions configs (#11303)

Move all navigation actions inside the actions configs
This commit is contained in:
Raphaël Bosi
2025-04-01 11:23:28 +02:00
committed by GitHub
parent f6e4cd45ed
commit a24e96ae0e
75 changed files with 2717 additions and 149 deletions

View File

@ -4,6 +4,11 @@ import { useExportMultipleRecordsAction } from '@/action-menu/actions/record-act
import { useRestoreMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useRestoreMultipleRecordsAction';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
import { useCreateNewTableRecordNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useCreateNewTableRecordNoSelectionRecordAction';
import { useGoToCompaniesNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToCompaniesNoSelectionRecordAction';
import { useGoToOpportunitiesNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToOpportunitiesNoSelectionRecordAction';
import { useGoToPeopleNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToPeopleNoSelectionRecordAction';
import { useGoToSettingsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToSettingsNoSelectionRecordAction';
import { useGoToTasksNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToTasksNoSelectionRecordAction';
import { useHideDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useHideDeletedRecordsNoSelectionRecordAction';
import { useImportRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useImportRecordsNoSelectionRecordAction';
import { useSeeDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeDeletedRecordsNoSelectionRecordAction';
@ -27,6 +32,8 @@ import {
} from '@/action-menu/types/ActionMenuEntry';
import { msg } from '@lingui/core/macro';
import {
IconBuildingSkyscraper,
IconCheckbox,
IconChevronDown,
IconChevronUp,
IconEyeOff,
@ -37,9 +44,12 @@ import {
IconPlus,
IconRefresh,
IconRotate2,
IconSettings,
IconSettingsAutomation,
IconTargetArrow,
IconTrash,
IconTrashX,
IconUser,
} from 'twenty-ui';
export const DEFAULT_ACTIONS_CONFIG: Record<
@ -295,7 +305,7 @@ export const DEFAULT_ACTIONS_CONFIG: Record<
seeAllWorkflows: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.SEE_WORKFLOWS,
key: NoSelectionRecordActionKeys.GO_TO_WORKFLOWS,
label: msg`Go to workflows`,
shortLabel: msg`See workflows`,
position: 18,
@ -306,4 +316,94 @@ export const DEFAULT_ACTIONS_CONFIG: Record<
useAction: useSeeWorkflowsNoSelectionRecordAction,
hotKeys: ['G', 'W'],
},
goToPeople: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_PEOPLE,
label: msg`Go to People`,
shortLabel: msg`People`,
position: 19,
Icon: IconUser,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToPeopleNoSelectionRecordAction,
hotKeys: ['G', 'P'],
},
goToCompanies: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_COMPANIES,
label: msg`Go to Companies`,
shortLabel: msg`Companies`,
position: 20,
Icon: IconBuildingSkyscraper,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToCompaniesNoSelectionRecordAction,
hotKeys: ['G', 'C'],
},
goToOpportunities: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_OPPORTUNITIES,
label: msg`Go to Opportunities`,
shortLabel: msg`Opportunities`,
position: 21,
Icon: IconTargetArrow,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToOpportunitiesNoSelectionRecordAction,
hotKeys: ['G', 'O'],
},
goToSettings: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_SETTINGS,
label: msg`Go to Settings`,
shortLabel: msg`Settings`,
position: 22,
Icon: IconSettings,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToSettingsNoSelectionRecordAction,
hotKeys: ['G', 'S'],
},
goToTasks: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_TASKS,
label: msg`Go to Tasks`,
shortLabel: msg`Tasks`,
position: 23,
Icon: IconCheckbox,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToTasksNoSelectionRecordAction,
hotKeys: ['G', 'T'],
},
};

View File

@ -3,6 +3,11 @@ import { useDestroyMultipleRecordsAction } from '@/action-menu/actions/record-ac
import { useExportMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
import { useCreateNewTableRecordNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useCreateNewTableRecordNoSelectionRecordAction';
import { useGoToCompaniesNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToCompaniesNoSelectionRecordAction';
import { useGoToOpportunitiesNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToOpportunitiesNoSelectionRecordAction';
import { useGoToPeopleNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToPeopleNoSelectionRecordAction';
import { useGoToSettingsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToSettingsNoSelectionRecordAction';
import { useGoToTasksNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToTasksNoSelectionRecordAction';
import { useHideDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useHideDeletedRecordsNoSelectionRecordAction';
import { useImportRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useImportRecordsNoSelectionRecordAction';
import { useSeeDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeDeletedRecordsNoSelectionRecordAction';
@ -32,6 +37,8 @@ import {
} from '@/action-menu/types/ActionMenuEntry';
import { msg } from '@lingui/core/macro';
import {
IconBuildingSkyscraper,
IconCheckbox,
IconChevronDown,
IconChevronUp,
IconDatabaseExport,
@ -46,8 +53,11 @@ import {
IconPlus,
IconPower,
IconRotate2,
IconSettings,
IconTargetArrow,
IconTrash,
IconTrashX,
IconUser,
IconVersions,
} from 'twenty-ui';
@ -366,7 +376,7 @@ export const WORKFLOW_ACTIONS_CONFIG: Record<
seeAllRuns: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.SEE_RUNS,
key: NoSelectionRecordActionKeys.GO_TO_RUNS,
label: msg`Go to runs`,
shortLabel: msg`See runs`,
position: 22,
@ -376,34 +386,94 @@ export const WORKFLOW_ACTIONS_CONFIG: Record<
availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
useAction: useSeeRunsNoSelectionRecordAction,
},
// TODO: uncomment when restore is implemented for workflows
// restoreSingleRecord: {
// type: ActionMenuEntryType.Standard,
// scope: ActionMenuEntryScope.RecordSelection,
// key: SingleRecordActionKeys.RESTORE,
// label: msg`Restore workflow`,
// shortLabel: msg`Restore`,
// position: 15,
// Icon: IconRefresh,
// accent: 'default',
// isPinned: true,
// availableOn: [
// ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
// ActionViewType.SHOW_PAGE,
// ],
// useAction: useRestoreSingleRecordAction,
// },
// restoreMultipleRecords: {
// type: ActionMenuEntryType.Standard,
// scope: ActionMenuEntryScope.RecordSelection,
// key: MultipleRecordsActionKeys.RESTORE,
// label: msg`Restore workflows`,
// shortLabel: msg`Restore`,
// position: 16,
// Icon: IconRefresh,
// accent: 'default',
// isPinned: true,
// availableOn: [ActionViewType.INDEX_PAGE_BULK_SELECTION],
// useAction: useRestoreMultipleRecordsAction,
// },
goToPeople: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_PEOPLE,
label: msg`Go to People`,
shortLabel: msg`People`,
position: 23,
Icon: IconUser,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToPeopleNoSelectionRecordAction,
hotKeys: ['G', 'P'],
},
goToCompanies: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_COMPANIES,
label: msg`Go to Companies`,
shortLabel: msg`Companies`,
position: 24,
Icon: IconBuildingSkyscraper,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToCompaniesNoSelectionRecordAction,
hotKeys: ['G', 'C'],
},
goToOpportunities: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_OPPORTUNITIES,
label: msg`Go to Opportunities`,
shortLabel: msg`Opportunities`,
position: 25,
Icon: IconTargetArrow,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToOpportunitiesNoSelectionRecordAction,
hotKeys: ['G', 'O'],
},
goToSettings: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_SETTINGS,
label: msg`Go to Settings`,
shortLabel: msg`Settings`,
position: 26,
Icon: IconSettings,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToSettingsNoSelectionRecordAction,
hotKeys: ['G', 'S'],
},
goToTasks: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_TASKS,
label: msg`Go to Tasks`,
shortLabel: msg`Tasks`,
position: 27,
Icon: IconCheckbox,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToTasksNoSelectionRecordAction,
hotKeys: ['G', 'T'],
},
};

View File

@ -1,5 +1,10 @@
import { useExportMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
import { useGoToCompaniesNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToCompaniesNoSelectionRecordAction';
import { useGoToOpportunitiesNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToOpportunitiesNoSelectionRecordAction';
import { useGoToPeopleNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToPeopleNoSelectionRecordAction';
import { useGoToSettingsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToSettingsNoSelectionRecordAction';
import { useGoToTasksNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToTasksNoSelectionRecordAction';
import { useHideDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useHideDeletedRecordsNoSelectionRecordAction';
import { useSeeDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeDeletedRecordsNoSelectionRecordAction';
import { useSeeWorkflowsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeWorkflowsNoSelectionRecordAction';
@ -21,6 +26,8 @@ import {
} from '@/action-menu/types/ActionMenuEntry';
import { msg } from '@lingui/core/macro';
import {
IconBuildingSkyscraper,
IconCheckbox,
IconChevronDown,
IconChevronUp,
IconDatabaseExport,
@ -28,7 +35,10 @@ import {
IconHeart,
IconHeartOff,
IconRotate2,
IconSettings,
IconSettingsAutomation,
IconTargetArrow,
IconUser,
IconVersions,
} from 'twenty-ui';
@ -191,7 +201,7 @@ export const WORKFLOW_RUNS_ACTIONS_CONFIG: Record<
seeAllWorkflows: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.SEE_WORKFLOWS,
key: NoSelectionRecordActionKeys.GO_TO_WORKFLOWS,
label: msg`Go to workflows`,
shortLabel: msg`See workflows`,
position: 11,
@ -202,4 +212,94 @@ export const WORKFLOW_RUNS_ACTIONS_CONFIG: Record<
useAction: useSeeWorkflowsNoSelectionRecordAction,
hotKeys: ['G', 'W'],
},
goToPeople: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_PEOPLE,
label: msg`Go to People`,
shortLabel: msg`People`,
position: 12,
Icon: IconUser,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToPeopleNoSelectionRecordAction,
hotKeys: ['G', 'P'],
},
goToCompanies: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_COMPANIES,
label: msg`Go to Companies`,
shortLabel: msg`Companies`,
position: 13,
Icon: IconBuildingSkyscraper,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToCompaniesNoSelectionRecordAction,
hotKeys: ['G', 'C'],
},
goToOpportunities: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_OPPORTUNITIES,
label: msg`Go to Opportunities`,
shortLabel: msg`Opportunities`,
position: 14,
Icon: IconTargetArrow,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToOpportunitiesNoSelectionRecordAction,
hotKeys: ['G', 'O'],
},
goToSettings: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_SETTINGS,
label: msg`Go to Settings`,
shortLabel: msg`Settings`,
position: 15,
Icon: IconSettings,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToSettingsNoSelectionRecordAction,
hotKeys: ['G', 'S'],
},
goToTasks: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_TASKS,
label: msg`Go to Tasks`,
shortLabel: msg`Tasks`,
position: 16,
Icon: IconCheckbox,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToTasksNoSelectionRecordAction,
hotKeys: ['G', 'T'],
},
};

View File

@ -1,5 +1,10 @@
import { useExportMultipleRecordsAction } from '@/action-menu/actions/record-actions/multiple-records/hooks/useExportMultipleRecordsAction';
import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';
import { useGoToCompaniesNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToCompaniesNoSelectionRecordAction';
import { useGoToOpportunitiesNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToOpportunitiesNoSelectionRecordAction';
import { useGoToPeopleNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToPeopleNoSelectionRecordAction';
import { useGoToSettingsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToSettingsNoSelectionRecordAction';
import { useGoToTasksNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useGoToTasksNoSelectionRecordAction';
import { useHideDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useHideDeletedRecordsNoSelectionRecordAction';
import { useSeeDeletedRecordsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeDeletedRecordsNoSelectionRecordAction';
import { useSeeRunsNoSelectionRecordAction } from '@/action-menu/actions/record-actions/no-selection/hooks/useSeeRunsNoSelectionRecordAction';
@ -24,6 +29,8 @@ import {
} from '@/action-menu/types/ActionMenuEntry';
import { msg } from '@lingui/core/macro';
import {
IconBuildingSkyscraper,
IconCheckbox,
IconChevronDown,
IconChevronUp,
IconDatabaseExport,
@ -33,7 +40,10 @@ import {
IconHistoryToggle,
IconPencil,
IconRotate2,
IconSettings,
IconSettingsAutomation,
IconTargetArrow,
IconUser,
IconVersions,
} from 'twenty-ui';
@ -223,7 +233,7 @@ export const WORKFLOW_VERSIONS_ACTIONS_CONFIG: Record<
seeAllWorkflows: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.SEE_WORKFLOWS,
key: NoSelectionRecordActionKeys.GO_TO_WORKFLOWS,
label: msg`Go to workflows`,
shortLabel: msg`See workflows`,
position: 14,
@ -237,7 +247,7 @@ export const WORKFLOW_VERSIONS_ACTIONS_CONFIG: Record<
seeAllRuns: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.SEE_RUNS,
key: NoSelectionRecordActionKeys.GO_TO_RUNS,
label: msg`Go to runs`,
shortLabel: msg`See runs`,
position: 15,
@ -247,4 +257,94 @@ export const WORKFLOW_VERSIONS_ACTIONS_CONFIG: Record<
availableOn: [ActionViewType.INDEX_PAGE_NO_SELECTION],
useAction: useSeeRunsNoSelectionRecordAction,
},
goToPeople: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_PEOPLE,
label: msg`Go to People`,
shortLabel: msg`People`,
position: 16,
Icon: IconUser,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToPeopleNoSelectionRecordAction,
hotKeys: ['G', 'P'],
},
goToCompanies: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_COMPANIES,
label: msg`Go to Companies`,
shortLabel: msg`Companies`,
position: 17,
Icon: IconBuildingSkyscraper,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToCompaniesNoSelectionRecordAction,
hotKeys: ['G', 'C'],
},
goToOpportunities: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_OPPORTUNITIES,
label: msg`Go to Opportunities`,
shortLabel: msg`Opportunities`,
position: 18,
Icon: IconTargetArrow,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToOpportunitiesNoSelectionRecordAction,
hotKeys: ['G', 'O'],
},
goToSettings: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_SETTINGS,
label: msg`Go to Settings`,
shortLabel: msg`Settings`,
position: 19,
Icon: IconSettings,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToSettingsNoSelectionRecordAction,
hotKeys: ['G', 'S'],
},
goToTasks: {
type: ActionMenuEntryType.Navigation,
scope: ActionMenuEntryScope.Global,
key: NoSelectionRecordActionKeys.GO_TO_TASKS,
label: msg`Go to Tasks`,
shortLabel: msg`Tasks`,
position: 20,
Icon: IconCheckbox,
isPinned: false,
availableOn: [
ActionViewType.INDEX_PAGE_NO_SELECTION,
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
ActionViewType.INDEX_PAGE_BULK_SELECTION,
ActionViewType.SHOW_PAGE,
],
useAction: useGoToTasksNoSelectionRecordAction,
hotKeys: ['G', 'T'],
},
};

View File

@ -0,0 +1,22 @@
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';
import { AppPath } from '@/types/AppPath';
import { useNavigateApp } from '~/hooks/useNavigateApp';
export const useGoToCompaniesNoSelectionRecordAction: ActionHookWithoutObjectMetadataItem =
() => {
const navigateApp = useNavigateApp();
const shouldBeRegistered = true;
const onClick = () => {
navigateApp(AppPath.RecordIndexPage, {
objectNamePlural: CoreObjectNamePlural.Company,
});
};
return {
shouldBeRegistered,
onClick,
};
};

View File

@ -0,0 +1,22 @@
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';
import { AppPath } from '@/types/AppPath';
import { useNavigateApp } from '~/hooks/useNavigateApp';
export const useGoToOpportunitiesNoSelectionRecordAction: ActionHookWithoutObjectMetadataItem =
() => {
const navigateApp = useNavigateApp();
const shouldBeRegistered = true;
const onClick = () => {
navigateApp(AppPath.RecordIndexPage, {
objectNamePlural: CoreObjectNamePlural.Opportunity,
});
};
return {
shouldBeRegistered,
onClick,
};
};

View File

@ -0,0 +1,22 @@
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';
import { AppPath } from '@/types/AppPath';
import { useNavigateApp } from '~/hooks/useNavigateApp';
export const useGoToPeopleNoSelectionRecordAction: ActionHookWithoutObjectMetadataItem =
() => {
const navigateApp = useNavigateApp();
const shouldBeRegistered = true;
const onClick = () => {
navigateApp(AppPath.RecordIndexPage, {
objectNamePlural: CoreObjectNamePlural.Person,
});
};
return {
shouldBeRegistered,
onClick,
};
};

View File

@ -0,0 +1,19 @@
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
import { SettingsPath } from '@/types/SettingsPath';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
export const useGoToSettingsNoSelectionRecordAction: ActionHookWithoutObjectMetadataItem =
() => {
const navigateSettings = useNavigateSettings();
const shouldBeRegistered = true;
const onClick = () => {
navigateSettings(SettingsPath.ProfilePage);
};
return {
shouldBeRegistered,
onClick,
};
};

View File

@ -0,0 +1,22 @@
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';
import { AppPath } from '@/types/AppPath';
import { useNavigateApp } from '~/hooks/useNavigateApp';
export const useGoToTasksNoSelectionRecordAction: ActionHookWithoutObjectMetadataItem =
() => {
const navigateApp = useNavigateApp();
const shouldBeRegistered = true;
const onClick = () => {
navigateApp(AppPath.RecordIndexPage, {
objectNamePlural: CoreObjectNamePlural.Task,
});
};
return {
shouldBeRegistered,
onClick,
};
};

View File

@ -4,6 +4,11 @@ export enum NoSelectionRecordActionKeys {
SEE_DELETED_RECORDS = 'see-deleted-records',
HIDE_DELETED_RECORDS = 'hide-deleted-records',
IMPORT_RECORDS = 'import-records',
SEE_RUNS = 'see-runs',
SEE_WORKFLOWS = 'see-workflows',
GO_TO_RUNS = 'go-to-runs',
GO_TO_WORKFLOWS = 'go-to-workflows',
GO_TO_PEOPLE = 'go-to-people',
GO_TO_COMPANIES = 'go-to-companies',
GO_TO_OPPORTUNITIES = 'go-to-opportunities',
GO_TO_SETTINGS = 'go-to-settings',
GO_TO_TASKS = 'go-to-tasks',
}

View File

@ -21,6 +21,7 @@ import { commandMenuNavigationStackState } from '@/command-menu/states/commandMe
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
import { CommandMenuPages } from '@/command-menu/types/CommandMenuPages';
import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext';
import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType';
import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/record-filter-group/states/context/RecordFilterGroupsComponentInstanceContext';
import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext';
import { RecordSortsComponentInstanceContext } from '@/object-record/record-sort/states/context/RecordSortsComponentInstanceContext';
@ -49,7 +50,11 @@ const ContextStoreDecorator: Decorator = (Story) => {
<ActionMenuComponentInstanceContext.Provider
value={{ instanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID }}
>
<JestContextStoreSetter contextStoreCurrentObjectMetadataNameSingular="company">
<JestContextStoreSetter
contextStoreCurrentObjectMetadataNameSingular="company"
contextStoreCurrentViewId="1"
contextStoreCurrentViewType={ContextStoreViewType.Table}
>
<Story />
</JestContextStoreSetter>
</ActionMenuComponentInstanceContext.Provider>

View File

@ -1,70 +0,0 @@
import {
IconBuildingSkyscraper,
IconCheckbox,
IconSettings,
IconTargetArrow,
IconUser,
} from 'twenty-ui';
import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';
import { AppPath } from '@/types/AppPath';
import { SettingsPath } from '@/types/SettingsPath';
import { getAppPath } from '~/utils/navigation/getAppPath';
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
import { Command, CommandType } from '../types/Command';
export const COMMAND_MENU_NAVIGATE_COMMANDS: { [key: string]: Command } = {
people: {
id: 'go-to-people',
to: getAppPath(AppPath.RecordIndexPage, {
objectNamePlural: CoreObjectNamePlural.Person,
}),
label: 'Go to People',
type: CommandType.Navigate,
hotKeys: ['G', 'P'],
Icon: IconUser,
shouldCloseCommandMenuOnClick: true,
},
companies: {
id: 'go-to-companies',
to: getAppPath(AppPath.RecordIndexPage, {
objectNamePlural: CoreObjectNamePlural.Company,
}),
label: 'Go to Companies',
type: CommandType.Navigate,
hotKeys: ['G', 'C'],
Icon: IconBuildingSkyscraper,
shouldCloseCommandMenuOnClick: true,
},
opportunities: {
id: 'go-to-activities',
to: getAppPath(AppPath.RecordIndexPage, {
objectNamePlural: CoreObjectNamePlural.Opportunity,
}),
label: 'Go to Opportunities',
type: CommandType.Navigate,
hotKeys: ['G', 'O'],
Icon: IconTargetArrow,
shouldCloseCommandMenuOnClick: true,
},
settings: {
id: 'go-to-settings',
to: getSettingsPath(SettingsPath.ProfilePage),
label: 'Go to Settings',
type: CommandType.Navigate,
hotKeys: ['G', 'S'],
Icon: IconSettings,
shouldCloseCommandMenuOnClick: true,
},
tasks: {
id: 'go-to-tasks',
to: getAppPath(AppPath.RecordIndexPage, {
objectNamePlural: CoreObjectNamePlural.Task,
}),
label: 'Go to Tasks',
type: CommandType.Navigate,
hotKeys: ['G', 'T'],
Icon: IconCheckbox,
shouldCloseCommandMenuOnClick: true,
},
};

View File

@ -3,7 +3,6 @@ import {
ActionMenuEntryScope,
ActionMenuEntryType,
} from '@/action-menu/types/ActionMenuEntry';
import { COMMAND_MENU_NAVIGATE_COMMANDS } from '@/command-menu/constants/CommandMenuNavigateCommands';
import {
Command,
CommandScope,
@ -32,14 +31,6 @@ export const useCommandMenuCommands = () => {
hotKeys: actionMenuEntry.hotKeys,
})) as Command[];
// TODO: refactor this to use the config
const navigateCommandsFromConstants = Object.values(
COMMAND_MENU_NAVIGATE_COMMANDS,
);
const allNavigateCommands = navigateCommands.concat(
navigateCommandsFromConstants,
);
const actionRecordSelectionCommands: Command[] = actionMenuEntries
?.filter(
(actionMenuEntry) =>
@ -136,7 +127,7 @@ export const useCommandMenuCommands = () => {
}));
return {
navigateCommands: allNavigateCommands,
navigateCommands,
actionRecordSelectionCommands,
actionGlobalCommands,
actionObjectCommands,