545 replace objects icons and names with records avatars and labelidentifiers in command menu context chips (#10787)
Closes https://github.com/twentyhq/core-team-issues/issues/545 This PR: - Introduces `commandMenuNavigationMorphItemsState` which stores the information about the `recordId` and the `objectMetadataItemId` for each page - Creates `CommandMenuContextChipEffect`, which queries the records from the previous pages in case a record has been updated during the navigation, to keep up to date information and stores it inside `commandMenuNavigationRecordsState` - `useCommandMenuContextChips` returns the context chips information - Style updates (icons background and color) - Updates `useCommandMenu` to set and reset these new states https://github.com/user-attachments/assets/8886848a-721d-4709-9330-8e84ebc0d51e
This commit is contained in:
@ -0,0 +1,9 @@
|
||||
import { MorphItem } from '@/object-record/multiple-objects/types/MorphItem';
|
||||
import { createState } from '@ui/utilities/state/utils/createState';
|
||||
|
||||
export const commandMenuNavigationMorphItemByPageState = createState<
|
||||
Map<string, MorphItem>
|
||||
>({
|
||||
key: 'command-menu/commandMenuNavigationMorphItemByPageState',
|
||||
defaultValue: new Map(),
|
||||
});
|
||||
@ -0,0 +1,13 @@
|
||||
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
||||
import { createState } from '@ui/utilities/state/utils/createState';
|
||||
|
||||
export const commandMenuNavigationRecordsState = createState<
|
||||
{
|
||||
objectMetadataItem: ObjectMetadataItem;
|
||||
record: ObjectRecord;
|
||||
}[]
|
||||
>({
|
||||
key: 'command-menu/commandMenuNavigationRecordsState',
|
||||
defaultValue: [],
|
||||
});
|
||||
@ -5,6 +5,7 @@ export type CommandMenuNavigationStackItem = {
|
||||
page: CommandMenuPages;
|
||||
pageTitle: string;
|
||||
pageIcon: IconComponent;
|
||||
pageIconColor?: string;
|
||||
pageId: string;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user