[FRONT COMPONENTS] Declare command menu items in front components (#18047)
## Description
- Adds support for declaring command menu items directly within
`defineFrontComponent` via an optional command config property
- Introduces a new `CommandMenuItemManifest` type in twenty-shared and
wires it through the manifest build pipeline
## Example Of usage
```tsx
import { defineFrontComponent } from "twenty-sdk";
const TestAction = () => {
return <div>Test Action</div>;
};
export default defineFrontComponent({
universalIdentifier: "6c289461-0007-4a62-a99f-69e5c11a4ce7",
name: "test-action",
description: "Test Action",
component: TestAction,
command: {
universalIdentifier: "c07df864-495f-46f3-9f5b-9d3ce2589e9b",
label: "Run My Action",
icon: "IconBolt",
isPinned: false,
},
});
```
## Video QA
https://github.com/user-attachments/assets/f910fc6a-44a9-45d1-87c5-f0ce64bb3878
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
import { type SyncableEntityOptions } from '@/application/syncableEntityOptionsType';
|
||||
|
||||
export type CommandMenuItemManifest = SyncableEntityOptions & {
|
||||
label: string;
|
||||
icon?: string;
|
||||
isPinned?: boolean;
|
||||
availabilityType?: 'GLOBAL' | 'SINGLE_RECORD' | 'BULK_RECORDS';
|
||||
availabilityObjectUniversalIdentifier?: string;
|
||||
frontComponentUniversalIdentifier: string;
|
||||
};
|
||||
|
||||
export type FrontComponentCommandManifest = Omit<
|
||||
CommandMenuItemManifest,
|
||||
'frontComponentUniversalIdentifier'
|
||||
>;
|
||||
|
||||
export type FrontComponentManifest = {
|
||||
universalIdentifier: string;
|
||||
name?: string;
|
||||
@@ -6,4 +22,5 @@ export type FrontComponentManifest = {
|
||||
builtComponentPath: string;
|
||||
builtComponentChecksum: string;
|
||||
componentName: string;
|
||||
command?: FrontComponentCommandManifest;
|
||||
};
|
||||
|
||||
@@ -25,7 +25,11 @@ export type {
|
||||
RelationFieldManifest,
|
||||
FieldManifest,
|
||||
} from './fieldManifestType';
|
||||
export type { FrontComponentManifest } from './frontComponentManifestType';
|
||||
export type {
|
||||
CommandMenuItemManifest,
|
||||
FrontComponentCommandManifest,
|
||||
FrontComponentManifest,
|
||||
} from './frontComponentManifestType';
|
||||
export type {
|
||||
LogicFunctionManifest,
|
||||
CronTriggerSettings,
|
||||
|
||||
Reference in New Issue
Block a user