feat: CommandMenuItem entity and FrontComponent support in command menu (#17555)
https://github.com/user-attachments/assets/6f172ffc-d43d-42fd-a26b-94f591fb767e
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
import { viewableFrontComponentIdComponentState } from '@/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState';
|
||||
import { FrontComponentRenderer } from '@/front-components/components/FrontComponentRenderer';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const CommandMenuFrontComponentPage = () => {
|
||||
const viewableFrontComponentId = useRecoilComponentValue(
|
||||
viewableFrontComponentIdComponentState,
|
||||
);
|
||||
|
||||
if (!isDefined(viewableFrontComponentId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <FrontComponentRenderer frontComponentId={viewableFrontComponentId} />;
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
|
||||
export const viewableFrontComponentIdComponentState = createComponentState<
|
||||
string | null
|
||||
>({
|
||||
key: 'command-menu/viewable-front-component-id',
|
||||
defaultValue: null,
|
||||
componentInstanceContext: CommandMenuPageComponentInstanceContext,
|
||||
});
|
||||
Reference in New Issue
Block a user