Add icon select to manual trigger (#12724)

## After

<img width="1220" alt="image"
src="https://github.com/user-attachments/assets/98a73aae-80d7-4e92-93d3-be13210da88b"
/>

<img width="1131" alt="image"
src="https://github.com/user-attachments/assets/9919e415-4355-4995-8979-9055b821f1e9"
/>

<img width="1300" alt="image"
src="https://github.com/user-attachments/assets/27f11cb3-d72c-468a-a641-8414172b9b54"
/>

<img width="1353" alt="image"
src="https://github.com/user-attachments/assets/2f0037f2-fe17-48b6-b7e6-c7528687a5fd"
/>
This commit is contained in:
martmull
2025-06-19 18:32:42 +02:00
committed by GitHub
parent adcf6107e7
commit 28466ecbf3
17 changed files with 208 additions and 69 deletions

View File

@ -11,7 +11,8 @@ import { msg } from '@lingui/core/macro';
import { useRecoilValue } from 'recoil';
import { capitalize, isDefined } from 'twenty-shared/utils';
import { IconSettingsAutomation } from 'twenty-ui/display';
import { useIcons } from 'twenty-ui/display';
import { COMMAND_MENU_DEFAULT_ICON } from '@/workflow/workflow-trigger/constants/CommandMenuDefaultIcon';
export const useRunWorkflowRecordActions = ({
objectMetadataItem,
@ -20,6 +21,7 @@ export const useRunWorkflowRecordActions = ({
objectMetadataItem: ObjectMetadataItem;
skip?: boolean;
}) => {
const { getIcon } = useIcons();
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
contextStoreTargetedRecordsRuleComponentState,
);
@ -48,13 +50,18 @@ export const useRunWorkflowRecordActions = ({
.map((activeWorkflowVersion, index) => {
const name = capitalize(activeWorkflowVersion.workflow.name);
const Icon = getIcon(
activeWorkflowVersion.trigger?.settings.icon,
COMMAND_MENU_DEFAULT_ICON,
);
return {
type: ActionType.WorkflowRun,
key: `workflow-run-${activeWorkflowVersion.id}`,
scope: ActionScope.RecordSelection,
label: msg`${name}`,
position: index,
Icon: IconSettingsAutomation,
Icon,
shouldBeRegistered: () => true,
component: (
<Action

View File

@ -7,9 +7,12 @@ import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
import { msg } from '@lingui/core/macro';
import { useContext } from 'react';
import { capitalize, isDefined } from 'twenty-shared/utils';
import { IconSettingsAutomation } from 'twenty-ui/display';
import { useIcons } from 'twenty-ui/display';
import { COMMAND_MENU_DEFAULT_ICON } from '@/workflow/workflow-trigger/constants/CommandMenuDefaultIcon';
export const useRunWorkflowRecordAgnosticActions = () => {
const { getIcon } = useIcons();
const { actionMenuType } = useContext(ActionMenuContext);
const { records: activeWorkflowVersions } =
@ -29,13 +32,18 @@ export const useRunWorkflowRecordAgnosticActions = () => {
const name = capitalize(activeWorkflowVersion.workflow.name);
const Icon = getIcon(
activeWorkflowVersion.trigger?.settings.icon,
COMMAND_MENU_DEFAULT_ICON,
);
return {
type: ActionType.WorkflowRun,
key: `workflow-run-${activeWorkflowVersion.id}`,
scope: ActionScope.Global,
label: msg`${name}`,
position: index,
Icon: IconSettingsAutomation,
Icon,
shouldBeRegistered: () => true,
component: (
<Action