Put delete button on step footer + add unique fields on upsert action (#15497)
<img width="491" height="823" alt="Capture d’écran 2025-10-31 à 14 54 38" src="https://github.com/user-attachments/assets/8058a6a3-8a6c-4cdd-93d9-2af71208dc5a" />
This commit is contained in:
+30
-9
@@ -11,6 +11,7 @@ import { useDuplicateStep } from '@/workflow/workflow-steps/hooks/useDuplicateSt
|
||||
import { useTheme } from '@emotion/react';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useId } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { TRIGGER_STEP_ID } from 'twenty-shared/workflow';
|
||||
import { IconCopyPlus, IconPencil, IconTrash } from 'twenty-ui/display';
|
||||
import { Button } from 'twenty-ui/input';
|
||||
@@ -35,6 +36,8 @@ export const WorkflowStepFooter = ({
|
||||
openWorkflowTriggerTypeInCommandMenu,
|
||||
} = useWorkflowCommandMenu();
|
||||
const { deleteStep } = useDeleteStep();
|
||||
const shouldPinDeleteButton =
|
||||
!isDefined(additionalActions) || additionalActions.length === 0;
|
||||
|
||||
const OptionsDropdown = (
|
||||
<Dropdown
|
||||
@@ -77,14 +80,16 @@ export const WorkflowStepFooter = ({
|
||||
LeftIcon={IconCopyPlus}
|
||||
/>
|
||||
)}
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
closeDropdown(dropdownId);
|
||||
deleteStep(stepId);
|
||||
}}
|
||||
text={t`Delete node`}
|
||||
LeftIcon={IconTrash}
|
||||
/>
|
||||
{!shouldPinDeleteButton && (
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
closeDropdown(dropdownId);
|
||||
deleteStep(stepId);
|
||||
}}
|
||||
text={t`Delete node`}
|
||||
LeftIcon={IconTrash}
|
||||
/>
|
||||
)}
|
||||
</SelectableList>
|
||||
</DropdownMenuItemsContainer>
|
||||
</DropdownContent>
|
||||
@@ -92,9 +97,25 @@ export const WorkflowStepFooter = ({
|
||||
/>
|
||||
);
|
||||
|
||||
const deleteButton = (
|
||||
<Button
|
||||
title="Delete"
|
||||
onClick={() => {
|
||||
deleteStep(stepId);
|
||||
}}
|
||||
Icon={IconTrash}
|
||||
accent="danger"
|
||||
inverted
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<RightDrawerFooter
|
||||
actions={[OptionsDropdown, ...(additionalActions ?? [])]}
|
||||
actions={[
|
||||
OptionsDropdown,
|
||||
...(additionalActions ?? []),
|
||||
...(shouldPinDeleteButton ? [deleteButton] : []),
|
||||
]}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user