Refactor command menu items deprecated code (#19508)

- Removes the intermediate `CommandMenuItemConfig` /
`CommandConfigContext` / `CommandMenuItemDisplay` abstraction layers,
replacing them with a single `CommandMenuItemRenderer` that renders
directly from the command menu items from the backend
- Eliminates the server-items/ subdirectory by moving its contents
(hooks/, contexts/, states/, display/, edit/) up into the parent
command-menu-item/ module, removing an unnecessary nesting level.
This commit is contained in:
Raphaël Bosi
2026-04-10 11:28:27 +02:00
committed by GitHub
parent f13e7e01fe
commit 4b3a46d953
132 changed files with 1376 additions and 2723 deletions
@@ -1,7 +1,7 @@
import { getCommandMenuDropdownIdFromCommandMenuId } from '@/command-menu-item/utils/getCommandMenuDropdownIdFromCommandMenuId';
describe('getCommandMenuDropdownIdFromCommandMenuId', () => {
it('should return the correct action menu dropdown id', () => {
it('should return the correct command menu dropdown id', () => {
expect(getCommandMenuDropdownIdFromCommandMenuId('command-menu-id')).toBe(
'command-menu-dropdown-command-menu-id',
);
@@ -1,7 +1,7 @@
import { getCommandMenuIdFromRecordIndexId } from '@/command-menu-item/utils/getCommandMenuIdFromRecordIndexId';
describe('getCommandMenuIdFromRecordIndexId', () => {
it('should return the correct action menu id', () => {
it('should return the correct command menu id', () => {
expect(getCommandMenuIdFromRecordIndexId('record-index-id')).toBe(
'command-menu-record-index-record-index-id',
);
@@ -1,7 +1,7 @@
import { getSidePanelCommandMenuDropdownIdFromCommandMenuId } from '@/command-menu-item/utils/getSidePanelCommandMenuDropdownIdFromCommandMenuId';
describe('getSidePanelCommandMenuDropdownIdFromCommandMenuId', () => {
it('should return the side panel action menu dropdown id', () => {
it('should return the side panel command menu dropdown id', () => {
expect(
getSidePanelCommandMenuDropdownIdFromCommandMenuId('command-menu-id'),
).toBe('side-panel-command-menu-dropdown-command-menu-id');
@@ -0,0 +1,7 @@
import { isDefined } from 'twenty-shared/utils';
import { type CommandMenuItemFieldsFragment } from '~/generated-metadata/graphql';
export const doesCommandMenuItemMatchObjectMetadataId =
(objectMetadataItemId: unknown) => (item: CommandMenuItemFieldsFragment) =>
!isDefined(item.availabilityObjectMetadataId) ||
item.availabilityObjectMetadataId === objectMetadataItemId;
@@ -0,0 +1,18 @@
import { type CommandMenuItemFieldsFragment } from '~/generated-metadata/graphql';
export const groupCommandMenuItems = (
items: CommandMenuItemFieldsFragment[],
) => {
const pinned: CommandMenuItemFieldsFragment[] = [];
const other: CommandMenuItemFieldsFragment[] = [];
for (const item of items) {
if (item.isPinned) {
pinned.push(item);
} else {
other.push(item);
}
}
return { pinned, other };
};