The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Create edit dashboard action (#14564)
Raphaël Bosi0750bcaefcf2
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DashboardActionsConfig.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DashboardActionsConfig.tsxnew file mode 100644index 00000000000..6e0bf94a112--- /dev/null+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DashboardActionsConfig.tsx@@ -0,0 +1,74 @@+import { EditDashboardSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction';+import { DashboardSingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/dashboard-actions/types/DashboardSingleRecordActionKeys';+import { SingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey';+import { inheritActionsFromDefaultConfig } from '@/action-menu/actions/record-actions/utils/inheritActionsFromDefaultConfig';+import { ActionScope } from '@/action-menu/actions/types/ActionScope';+import { ActionType } from '@/action-menu/actions/types/ActionType';+import { ActionViewType } from '@/action-menu/actions/types/ActionViewType';+import { msg } from '@lingui/core/macro';+import { isDefined } from 'twenty-shared/utils';+import { IconPencil } from 'twenty-ui/display';++export const DASHBOARD_ACTIONS_CONFIG = inheritActionsFromDefaultConfig({+ config: {+ [DashboardSingleRecordActionKeys.EDIT_DASHBOARD]: {+ key: DashboardSingleRecordActionKeys.EDIT_DASHBOARD,+ label: msg`Edit Dashboard`,+ shortLabel: msg`Edit`,+ isPinned: true,+ position: 1,+ Icon: IconPencil,+ type: ActionType.Standard,+ scope: ActionScope.RecordSelection,+ shouldBeRegistered: ({ selectedRecord }) =>+ isDefined(selectedRecord) &&+ !selectedRecord?.isRemote &&+ !isDefined(selectedRecord?.deletedAt) &&+ isDefined(selectedRecord?.pageLayoutId),+ availableOn: [ActionViewType.SHOW_PAGE],+ component: <EditDashboardSingleRecordAction />,+ },+ },+ actionKeys: [+ SingleRecordActionKeys.ADD_TO_FAVORITES,+ SingleRecordActionKeys.REMOVE_FROM_FAVORITES,+ SingleRecordActionKeys.DELETE,+ SingleRecordActionKeys.DESTROY,+ SingleRecordActionKeys.RESTORE,+ SingleRecordActionKeys.EXPORT_FROM_RECORD_SHOW,+ SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD,+ SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD,+ ],+ propertiesToOverwrite: {+ [SingleRecordActionKeys.ADD_TO_FAVORITES]: {+ position: 2,+ },+ [SingleRecordActionKeys.REMOVE_FROM_FAVORITES]: {+ position: 3,+ },+ [SingleRecordActionKeys.DELETE]: {+ position: 4,+ label: msg`Delete dashboard`,+ },+ [SingleRecordActionKeys.EXPORT_FROM_RECORD_SHOW]: {+ position: 5,+ label: msg`Export dashboard`,+ },+ [SingleRecordActionKeys.DESTROY]: {+ position: 6,+ label: msg`Permanently destroy dashboard`,+ },+ [SingleRecordActionKeys.RESTORE]: {+ position: 7,+ label: msg`Restore dashboard`,+ },+ [SingleRecordActionKeys.NAVIGATE_TO_PREVIOUS_RECORD]: {+ position: 8,+ label: msg`Navigate to previous dashboard`,+ },+ [SingleRecordActionKeys.NAVIGATE_TO_NEXT_RECORD]: {+ position: 9,+ label: msg`Navigate to next dashboard`,+ },+ },+});diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowActionsConfig.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowActionsConfig.tsxindex 8058d507050..4660a12823e 100644--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowActionsConfig.tsx+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowActionsConfig.tsx@@ -1,7 +1,7 @@import { ActionLink } from '@/action-menu/actions/components/ActionLink';import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKeys';-import { NoSelectionWorkflowRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/workflow-actions/types/NoSelectionWorkflowRecordActionsKeys';+import { NoSelectionWorkflowRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/workflow-actions/types/NoSelectionWorkflowRecordActionKeys';import { SingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey';import { ActivateWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/components/ActivateWorkflowSingleRecordAction';import { DeactivateWorkflowSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-actions/components/DeactivateWorkflowSingleRecordAction';diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowVersionsActionsConfig.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowVersionsActionsConfig.tsxindex bdca663ad31..117614d9c60 100644--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowVersionsActionsConfig.tsx+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/WorkflowVersionsActionsConfig.tsx@@ -1,7 +1,7 @@import { ActionLink } from '@/action-menu/actions/components/ActionLink';import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys';import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKeys';-import { NoSelectionWorkflowRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/workflow-actions/types/NoSelectionWorkflowRecordActionsKeys';+import { NoSelectionWorkflowRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/workflow-actions/types/NoSelectionWorkflowRecordActionKeys';import { SingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey';import { SeeRunsWorkflowVersionSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeRunsWorkflowVersionSingleRecordAction';import { SeeVersionsWorkflowVersionSingleRecordAction } from '@/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeVersionsWorkflowVersionSingleRecordAction';diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/workflow-actions/types/NoSelectionWorkflowRecordActionsKeys.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/workflow-actions/types/NoSelectionWorkflowRecordActionKeys.tssimilarity index 100%rename from packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/workflow-actions/types/NoSelectionWorkflowRecordActionsKeys.tsrename to packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/workflow-actions/types/NoSelectionWorkflowRecordActionKeys.tsdiff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsxnew file mode 100644index 00000000000..6aada573848--- /dev/null+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx@@ -0,0 +1,22 @@+import { Action } from '@/action-menu/actions/components/Action';+import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';+import { useSetIsDashboardInEditMode } from '@/dashboards/hooks/useSetDashboardInEditMode';+import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';+import { useRecoilValue } from 'recoil';++export const EditDashboardSingleRecordAction = () => {+ const recordId = useSelectedRecordIdOrThrow();++ const selectedRecord = useRecoilValue(recordStoreFamilyState(recordId));++ const pageLayoutId = selectedRecord?.pageLayoutId;++ const { setIsDashboardInEditMode } =+ useSetIsDashboardInEditMode(pageLayoutId);++ const handleClick = () => {+ setIsDashboardInEditMode(true);+ };++ return <Action onClick={handleClick} />;+};diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/types/DashboardSingleRecordActionKeys.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/types/DashboardSingleRecordActionKeys.tsnew file mode 100644index 00000000000..3215b42c316--- /dev/null+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/types/DashboardSingleRecordActionKeys.ts@@ -0,0 +1,3 @@+export enum DashboardSingleRecordActionKeys {+ EDIT_DASHBOARD = 'edit-dashboard-single-record',+}diff --git a/packages/twenty-front/src/modules/action-menu/actions/states/forceRegisteredActionsMapComponentState.ts b/packages/twenty-front/src/modules/action-menu/actions/states/forceRegisteredActionsMapComponentState.tsnew file mode 100644index 00000000000..0eb30cdaec5--- /dev/null+++ b/packages/twenty-front/src/modules/action-menu/actions/states/forceRegisteredActionsMapComponentState.ts@@ -0,0 +1,10 @@+import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext';+import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';++export const forceRegisteredActionsByKeyComponentState = createComponentState<+ Record<string, boolean | undefined>+>({+ key: 'forceRegisteredActionsByKeyComponentState',+ defaultValue: {},+ componentInstanceContext: ActionMenuComponentInstanceContext,+});diff --git a/packages/twenty-front/src/modules/action-menu/actions/types/ShouldBeRegisteredFunctionParams.ts b/packages/twenty-front/src/modules/action-menu/actions/types/ShouldBeRegisteredFunctionParams.tsindex 4f4aa8fd492..0ff0a125dc9 100644--- a/packages/twenty-front/src/modules/action-menu/actions/types/ShouldBeRegisteredFunctionParams.ts+++ b/packages/twenty-front/src/modules/action-menu/actions/types/ShouldBeRegisteredFunctionParams.ts@@ -25,4 +25,5 @@ export type ShouldBeRegisteredFunctionParams = {getTargetObjectWritePermission: (objectMetadataItemNameSingular: string,) => boolean;+ forceRegisteredActionsByKey: Record<string, boolean | undefined>;};diff --git a/packages/twenty-front/src/modules/action-menu/actions/utils/getActionConfig.ts b/packages/twenty-front/src/modules/action-menu/actions/utils/getActionConfig.tsindex 0c27c6968a1..dca13c49b4c 100644--- a/packages/twenty-front/src/modules/action-menu/actions/utils/getActionConfig.ts+++ b/packages/twenty-front/src/modules/action-menu/actions/utils/getActionConfig.ts@@ -1,3 +1,4 @@+import { DASHBOARD_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/constants/DashboardActionsConfig';import { DEFAULT_RECORD_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/constants/DefaultRecordActionsConfig';import { WORKFLOW_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/constants/WorkflowActionsConfig';import { WORKFLOW_RUNS_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/constants/WorkflowRunsActionsConfig';@@ -17,6 +18,9 @@ export const getActionConfig = ({}switch (objectMetadataItem.nameSingular) {+ case CoreObjectNameSingular.Dashboard: {+ return DASHBOARD_ACTIONS_CONFIG;+ }case CoreObjectNameSingular.Workflow: {return WORKFLOW_ACTIONS_CONFIG;}diff --git a/packages/twenty-front/src/modules/action-menu/hooks/useRegisteredActions.ts b/packages/twenty-front/src/modules/action-menu/hooks/useRegisteredActions.tsindex 5322c5a67df..854ad450504 100644--- a/packages/twenty-front/src/modules/action-menu/hooks/useRegisteredActions.ts+++ b/packages/twenty-front/src/modules/action-menu/hooks/useRegisteredActions.ts@@ -14,7 +14,8 @@ import { useIcons } from 'twenty-ui/display';export const useRegisteredActions = (shouldBeRegisteredParams: ShouldBeRegisteredFunctionParams,) => {- const { objectMetadataItem } = shouldBeRegisteredParams;+ const { objectMetadataItem, forceRegisteredActionsByKey } =+ shouldBeRegisteredParams;const { getIcon } = useIcons();@@ -67,6 +68,15 @@ export const useRegisteredActions = () {return false;}+ const forcedShouldBeRegistered = forceRegisteredActionsByKey[action.key];++ if (isDefined(forcedShouldBeRegistered)) {+ return (+ forcedShouldBeRegistered &&+ action.shouldBeRegistered(shouldBeRegisteredParams)+ );+ }+return action.shouldBeRegistered(shouldBeRegisteredParams);}).sort((a, b) => a.position - b.position);diff --git a/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts b/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.tsindex 6ecb29f9d38..b407cbc0ffc 100644--- a/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts+++ b/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts@@ -1,3 +1,4 @@+import { forceRegisteredActionsByKeyComponentState } from '@/action-menu/actions/states/forceRegisteredActionsMapComponentState';import { type ShouldBeRegisteredFunctionParams } from '@/action-menu/actions/types/ShouldBeRegisteredFunctionParams';import { getActionViewType } from '@/action-menu/actions/utils/getActionViewType';import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';@@ -100,6 +101,10 @@ export const useShouldActionBeRegisteredParams = ({[],);+ const forceRegisteredActionsByKey = useRecoilComponentValue(+ forceRegisteredActionsByKeyComponentState,+ );+return {objectMetadataItem,isFavorite,@@ -113,5 +118,6 @@ export const useShouldActionBeRegisteredParams = ({viewType: viewType ?? undefined,getTargetObjectReadPermission: getObjectReadPermission,getTargetObjectWritePermission: getObjectWritePermission,+ forceRegisteredActionsByKey,};};diff --git a/packages/twenty-front/src/modules/dashboards/components/DashboardContentRenderer.tsx b/packages/twenty-front/src/modules/dashboards/components/DashboardContentRenderer.tsxnew file mode 100644index 00000000000..9f137856e3c--- /dev/null+++ b/packages/twenty-front/src/modules/dashboards/components/DashboardContentRenderer.tsx@@ -0,0 +1,33 @@+import { type Dashboard } from '@/dashboards/components/types/Dashboard';+import { useSetIsDashboardInEditMode } from '@/dashboards/hooks/useSetDashboardInEditMode';+import { PageLayoutRenderer } from '@/page-layout/components/PageLayoutRenderer';+import { type PageLayoutWithData } from '@/page-layout/types/pageLayoutTypes';+import { isPageLayoutEmpty } from '@/page-layout/utils/isPageLayoutEmpty';++type DashboardContentRendererProps = {+ dashboard: Dashboard;+};++export const DashboardContentRenderer = ({+ dashboard,+}: DashboardContentRendererProps) => {+ const pageLayoutId = dashboard.pageLayoutId;++ const { setIsDashboardInEditMode } =+ useSetIsDashboardInEditMode(pageLayoutId);++ const onInitialized = (pageLayout: PageLayoutWithData) => {+ if (isPageLayoutEmpty(pageLayout)) {+ setIsDashboardInEditMode(true);+ } else {+ setIsDashboardInEditMode(false);+ }+ };++ return (+ <PageLayoutRenderer+ pageLayoutId={pageLayoutId}+ onInitialized={onInitialized}+ />+ );+};diff --git a/packages/twenty-front/src/modules/dashboards/components/DashboardRenderer.tsx b/packages/twenty-front/src/modules/dashboards/components/DashboardRenderer.tsxindex e75d43fea8b..c38be75ba24 100644--- a/packages/twenty-front/src/modules/dashboards/components/DashboardRenderer.tsx+++ b/packages/twenty-front/src/modules/dashboards/components/DashboardRenderer.tsx@@ -1,7 +1,7 @@+import { DashboardContentRenderer } from '@/dashboards/components/DashboardContentRenderer';import { type Dashboard } from '@/dashboards/components/types/Dashboard';import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';-import { PageLayoutRenderer } from '@/page-layout/components/PageLayoutRenderer';import { isDefined } from 'twenty-shared/utils';type DashboardRendererProps = {@@ -18,5 +18,5 @@ export const DashboardRenderer = ({ recordId }: DashboardRendererProps) => {return null;}- return <PageLayoutRenderer pageLayoutId={dashboard.pageLayoutId} />;+ return <DashboardContentRenderer dashboard={dashboard} />;};diff --git a/packages/twenty-front/src/modules/dashboards/hooks/useSetDashboardInEditMode.ts b/packages/twenty-front/src/modules/dashboards/hooks/useSetDashboardInEditMode.tsnew file mode 100644index 00000000000..343418a271e--- /dev/null+++ b/packages/twenty-front/src/modules/dashboards/hooks/useSetDashboardInEditMode.ts@@ -0,0 +1,37 @@+import { DashboardSingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/dashboard-actions/types/DashboardSingleRecordActionKeys';+import { forceRegisteredActionsByKeyComponentState } from '@/action-menu/actions/states/forceRegisteredActionsMapComponentState';+import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext';+import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPageLayoutInEditModeComponentState';+import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';+import { useRecoilComponentCallbackState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackState';+import { useRecoilCallback } from 'recoil';++export const useSetIsDashboardInEditMode = (pageLayoutIdFromProps: string) => {+ const pageLayoutId = useAvailableComponentInstanceIdOrThrow(+ PageLayoutComponentInstanceContext,+ pageLayoutIdFromProps,+ );++ const isPageLayoutInEditModeState = useRecoilComponentCallbackState(+ isPageLayoutInEditModeComponentState,+ pageLayoutId,+ );++ const forceRegisteredActionsByKeyState = useRecoilComponentCallbackState(+ forceRegisteredActionsByKeyComponentState,+ );++ const setIsDashboardInEditMode = useRecoilCallback(+ ({ set }) =>+ (value: boolean) => {+ set(isPageLayoutInEditModeState, value);+ set(forceRegisteredActionsByKeyState, (prev) => ({+ ...prev,+ [DashboardSingleRecordActionKeys.EDIT_DASHBOARD]: !value,+ }));+ },+ [forceRegisteredActionsByKeyState, isPageLayoutInEditModeState],+ );++ return { setIsDashboardInEditMode };+};diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutInitializationQueryEffect.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutInitializationQueryEffect.tsxindex ab06cded0f6..7bc98395867 100644--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutInitializationQueryEffect.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutInitializationQueryEffect.tsx@@ -14,10 +14,12 @@ import { isDeeplyEqual } from '~/utils/isDeeplyEqual';type PageLayoutInitializationQueryEffectProps = {pageLayoutId: string;+ onInitialized: (pageLayout: PageLayoutWithData) => void;};export const PageLayoutInitializationQueryEffect = ({pageLayoutId,+ onInitialized,}: PageLayoutInitializationQueryEffectProps) => {const [isInitialized, setIsInitialized] = useState(false);@@ -88,9 +90,10 @@ export const PageLayoutInitializationQueryEffect = ({useEffect(() => {if (!isInitialized && isDefined(pageLayout)) {initializePageLayout(pageLayout);+ onInitialized?.(pageLayout);setIsInitialized(true);}- }, [initializePageLayout, isInitialized, pageLayout]);+ }, [initializePageLayout, isInitialized, pageLayout, onInitialized]);return null;};diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRenderer.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRenderer.tsxindex 53cc48364a5..323e16d64cb 100644--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRenderer.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRenderer.tsx@@ -2,6 +2,7 @@ import { PageLayoutInitializationQueryEffect } from '@/page-layout/components/Paimport { PageLayoutRendererContent } from '@/page-layout/components/PageLayoutRendererContent';import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext';+import { type PageLayoutWithData } from '@/page-layout/types/pageLayoutTypes';import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutId';import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext';import 'react-grid-layout/css/styles.css';@@ -9,10 +10,12 @@ import 'react-resizable/css/styles.css';type PageLayoutRendererProps = {pageLayoutId: string;+ onInitialized: (pageLayout: PageLayoutWithData) => void;};export const PageLayoutRenderer = ({pageLayoutId,+ onInitialized,}: PageLayoutRendererProps) => {return (<PageLayoutComponentInstanceContext.Provider@@ -25,7 +28,10 @@ export const PageLayoutRenderer = ({instanceId: getTabListInstanceIdFromPageLayoutId(pageLayoutId),}}>- <PageLayoutInitializationQueryEffect pageLayoutId={pageLayoutId} />+ <PageLayoutInitializationQueryEffect+ pageLayoutId={pageLayoutId}+ onInitialized={onInitialized}+ /><PageLayoutRendererContent /></TabListComponentInstanceContext.Provider></PageLayoutComponentInstanceContext.Provider>diff --git a/packages/twenty-front/src/modules/page-layout/utils/isPageLayoutEmpty.ts b/packages/twenty-front/src/modules/page-layout/utils/isPageLayoutEmpty.tsnew file mode 100644index 00000000000..92d2cfde120--- /dev/null+++ b/packages/twenty-front/src/modules/page-layout/utils/isPageLayoutEmpty.ts@@ -0,0 +1,7 @@+import { type PageLayoutWithData } from '~/modules/page-layout/types/pageLayoutTypes';++export const isPageLayoutEmpty = (pageLayout: PageLayoutWithData): boolean => {+ return (+ pageLayout.tabs.length === 1 && pageLayout.tabs[0].widgets.length === 0+ );+};diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsxindex 868dd2f4db7..07db62e6359 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx@@ -26,7 +26,6 @@ export const WidgetRenderer = ({ widget }: WidgetRendererProps) => {const isPageLayoutInEditMode = useRecoilComponentValue(isPageLayoutInEditModeComponentState,- widget.id,);return (