The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
[DASHBOARDS] Hide pinned workflow actions when dashboard is in edit mode (#17341)
Raphaël Bosid6f088f7203f
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/run-workflow-actions/hooks/useRunWorkflowRecordActions.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/run-workflow-actions/hooks/useRunWorkflowRecordActions.tsxindex 7d8e68bfb68..cc7d0fea6f3 100644--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/run-workflow-actions/hooks/useRunWorkflowRecordActions.tsx+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/run-workflow-actions/hooks/useRunWorkflowRecordActions.tsx@@ -2,6 +2,7 @@ import { Action } from '@/action-menu/actions/components/Action';import { isBulkRecordsManualTrigger } from '@/action-menu/actions/record-actions/utils/isBulkRecordsManualTrigger';import { ActionScope } from '@/action-menu/actions/types/ActionScope';import { ActionType } from '@/action-menu/actions/types/ActionType';+import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState';import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';@@ -31,6 +32,10 @@ export const useRunWorkflowRecordActions = ({contextStoreTargetedRecordsRuleComponentState,);+ const isPageInEditMode = useRecoilComponentValue(+ contextStoreIsPageInEditModeComponentState,+ );+const selectedRecordIds =contextStoreTargetedRecordsRule.mode === 'selection'? contextStoreTargetedRecordsRule.selectedRecordIds@@ -130,7 +135,9 @@ export const useRunWorkflowRecordActions = ({shortLabel: name,position: index,Icon,- isPinned: activeWorkflowVersion.trigger?.settings?.isPinned,+ isPinned:+ !isPageInEditMode &&+ activeWorkflowVersion.trigger?.settings?.isPinned,shouldBeRegistered: () => true,component: (<Actiondiff --git a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsxindex b4945f96d9d..57627168b5f 100644--- a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx+++ b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx@@ -2,6 +2,8 @@ import { Action } from '@/action-menu/actions/components/Action';import { ActionScope } from '@/action-menu/actions/types/ActionScope';import { ActionType } from '@/action-menu/actions/types/ActionType';import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';+import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState';+import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';import { useActiveWorkflowVersionsWithManualTrigger } from '@/workflow/hooks/useActiveWorkflowVersionsWithManualTrigger';import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';import { COMMAND_MENU_DEFAULT_ICON } from '@/workflow/workflow-trigger/constants/CommandMenuDefaultIcon';@@ -12,6 +14,10 @@ import { useIcons } from 'twenty-ui/display';export const useRunWorkflowRecordAgnosticActions = () => {const { getIcon } = useIcons();+ const isPageInEditMode = useRecoilComponentValue(+ contextStoreIsPageInEditModeComponentState,+ );+const { actionMenuType } = useContext(ActionMenuContext);const { records: activeWorkflowVersions } =@@ -43,7 +49,9 @@ export const useRunWorkflowRecordAgnosticActions = () => {label: name,shortLabel: name,position: index,- isPinned: activeWorkflowVersion.trigger?.settings?.isPinned,+ isPinned:+ !isPageInEditMode &&+ activeWorkflowVersion.trigger?.settings?.isPinned,Icon,shouldBeRegistered: () => true,component: (