Update trigger selection design (#9717)

https://github.com/user-attachments/assets/62bc705a-2f69-4ce7-986f-0208154c9965
This commit is contained in:
Thomas Trompette
2025-01-20 10:54:27 +01:00
committed by GitHub
parent 056cb7c66d
commit d50294d39a
13 changed files with 220 additions and 143 deletions

View File

@ -10,7 +10,7 @@ it('returns the expected name for a DATABASE_EVENT trigger', () => {
outputSchema: {},
},
}),
).toBe('Company is Created');
).toBe('Record is Created');
});
it('returns the expected name for a MANUAL trigger without a defined objectType', () => {

View File

@ -3,6 +3,7 @@ import {
WorkflowTrigger,
} from '@/workflow/types/Workflow';
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
import { DATABASE_TRIGGER_EVENTS } from '@/workflow/workflow-trigger/constants/DatabaseTriggerEvents';
import { capitalize } from 'twenty-shared';
import { isDefined } from 'twenty-ui';
@ -24,7 +25,9 @@ export const getTriggerStepName = (trigger: WorkflowTrigger): string => {
const getDatabaseEventTriggerStepName = (
trigger: WorkflowDatabaseEventTrigger,
): string => {
const [object, action] = trigger.settings.eventName.split('.');
const [, action] = trigger.settings.eventName.split('.');
return `${capitalize(object)} is ${capitalize(action)}`;
return (
DATABASE_TRIGGER_EVENTS.find((event) => event.value === action)?.label ?? ''
);
};