refactor: add empty state for autoamtion form

This commit is contained in:
Carlos Valente
2026-05-11 20:03:44 +02:00
committed by Carlos Valente
parent 2873698959
commit c8bae76121
@@ -26,7 +26,7 @@ export default function EventEditorTriggers({ triggers, eventId }: EventEditorTr
value: id,
label: title,
}));
const hasAutomationOptions = allAutomationOptions.length > 0;
const triggerOptions = eventTriggerOptions.map((cycle) => ({ value: cycle, label: cycle }));
const duplicateIds = new Set<string>();
@@ -41,7 +41,7 @@ export default function EventEditorTriggers({ triggers, eventId }: EventEditorTr
}
const handleAdd = () => {
if (allAutomationOptions.length === 0) return;
if (!hasAutomationOptions) return;
updateEntry({
id: eventId,
triggers: [
@@ -65,6 +65,12 @@ export default function EventEditorTriggers({ triggers, eventId }: EventEditorTr
{automationsEnabled === false && (
<Info>Automations are disabled. Event triggers stay configured, but they will not run until enabled.</Info>
)}
{automationsEnabled && !hasAutomationOptions && (
<Info>
<Info.Title>No automations available</Info.Title>
<Info.Body>Create an automation before attaching it to this event.</Info.Body>
</Info>
)}
{triggers.length > 0 && (
<div className={style.triggerList}>
<div className={style.triggerHeader}>
@@ -110,7 +116,7 @@ export default function EventEditorTriggers({ triggers, eventId }: EventEditorTr
* Duplicate combinations will only fire once per lifecycle event.
</span>
)}
{allAutomationOptions.length > 0 && (
{hasAutomationOptions && (
<Button variant='ghosted' onClick={handleAdd}>
<IoAdd /> Add automation
</Button>