Examples
Automation rule builder
Built with the mantine-form skill
Build a form for creating an automation rule in a project management app. A rule has a trigger ("when"), conditions ("if") and actions ("then").
Rule:
- name (required), description (optional)
Trigger:
- event (select: issue created, issue updated, comment added, due date approaching, status changed); "status changed" reveals optional "from status" and "to status" selects
Conditions:
- a root group of conditions combined with AND or OR (toggle on the group); a group can contain nested groups up to two levels deep; each group has "add condition", "add group" and, for nested groups, "remove group"
- a condition row is field + operator + value: field (select: title, description, status, priority, assignee, labels, story points, due date, created at, is blocked); the operator list depends on the field type (text: contains, does not contain, equals, is empty; number: equals, not equals, greater than, less than, between; date: before, after, within the next N days, is empty; option: is any of, is none of; boolean: is true, is false); the value input depends on field type and operator (text input, number input or two inputs for between, date picker or number of days, multi-select of the field's options, nothing for is empty / is true / is false)
- changing the field resets the operator and the value; changing the operator resets the value when its shape changes
- validation: the root group has at least one condition; every condition has an operator and a value when the operator needs one; between needs min lower than max; within the next N days needs 1 to 365; a nested group without conditions is an error
Actions:
- an ordered list of 1 to 5 actions, reorderable by drag and drop and by keyboard; action type (select: assign to member, set priority, add labels, move to status, post comment, send Slack message, set due date); each type has its own parameters (member select; priority select; labels multi-select; status select; comment textarea that supports {{issue.title}} and {{issue.assignee}} placeholders; Slack channel select and message; number of days from now)
- an action type can appear only once, except add labels and post comment
Behavior:
- a plain-language summary of the rule, updated live ("When an issue is created, if priority is High and labels include bug, then assign to Ada Lovelace and post a comment")
- "Test rule" opens a modal with a hard-coded sample issue shown as read-only values; it evaluates the conditions against the sample and lists each condition with matched / not matched and the actions that would run
- submit validates everything and focuses the first invalid field; on submit show a short notification (rule name and trigger) and display the rule JSON under the form; keep the form as is
Write tests for the component.