diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterColumn.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterColumn.tsx index 067b023ba7..f25fe8612c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterColumn.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterColumn.tsx @@ -14,6 +14,7 @@ type WorkflowStepFilterColumnProps = { stepFilter: StepFilter; stepFilterIndex: number; firstFilterLabel?: string; + preventDeletion?: boolean; }; const StyledContainer = styled.div` @@ -28,10 +29,11 @@ export const WorkflowStepFilterColumn = ({ stepFilter, stepFilterIndex, firstFilterLabel, + preventDeletion = false, }: WorkflowStepFilterColumnProps) => { const { readonly } = useContext(WorkflowStepFilterContext); - const shouldShowDropdown = !readonly; + const shouldShowDropdown = !readonly && !preventDeletion; return ( diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/if-else-action/components/WorkflowIfElseBranchEditor.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/if-else-action/components/WorkflowIfElseBranchEditor.tsx index 33c544e2a6..2711bf4d27 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/if-else-action/components/WorkflowIfElseBranchEditor.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/if-else-action/components/WorkflowIfElseBranchEditor.tsx @@ -8,7 +8,7 @@ import { type FilterSettings } from '@/workflow/workflow-steps/filters/types/Fil import { isStepFilterGroupChildAStepFilterGroup } from '@/workflow/workflow-steps/filters/utils/isStepFilterGroupChildAStepFilterGroup'; import styled from '@emotion/styled'; import { i18n, type MessageDescriptor } from '@lingui/core'; -import { type StepFilterGroup } from 'twenty-shared/types'; +import { type StepFilter, type StepFilterGroup } from 'twenty-shared/types'; import { capitalize, isDefined } from 'twenty-shared/utils'; import { type StepIfElseBranch } from 'twenty-shared/workflow'; @@ -58,9 +58,7 @@ export const WorkflowIfElseBranchEditor = ({ const isIfBranch = branchIndex === 0; - const isLastFilterInIfBranch = (stepFilter: { - stepFilterGroupId: string; - }): boolean => { + const isLastFilterInIfBranch = (stepFilter: StepFilter): boolean => { const childStepFilters = childStepFiltersAndChildStepFilterGroups.filter( (child) => !isStepFilterGroupChildAStepFilterGroup(child), ); @@ -79,26 +77,25 @@ export const WorkflowIfElseBranchEditor = ({ }; return ( - - - {isDefined(branchFilterGroup) && - childStepFiltersAndChildStepFilterGroups.map( - (stepFilterGroupChild, stepFilterGroupChildIndex) => ( - - {isStepFilterGroupChildAStepFilterGroup( - stepFilterGroupChild, - ) ? ( + + + + {isDefined(branchFilterGroup) && + childStepFiltersAndChildStepFilterGroups.map( + (stepFilterGroupChild, stepFilterGroupChildIndex) => { + const isFilterGroup = + isStepFilterGroupChildAStepFilterGroup(stepFilterGroupChild); + const preventDeletion = + !isFilterGroup && + isLastFilterInIfBranch(stepFilterGroupChild); + + return isFilterGroup ? ( - )} - - ), - )} - + ); + }, + )} + - {!readonly && isDefined(branchFilterGroup) && ( - - )} - + {!readonly && isDefined(branchFilterGroup) && ( + + )} + + ); };