From 934e2b7eb38ee7e470e649c60039cb6b57cfc703 Mon Sep 17 00:00:00 2001 From: Taylor Ho Date: Fri, 14 Aug 2026 09:32:46 -0700 Subject: [PATCH] Refine workflow filter controls Signed-off-by: Taylor Ho --- .../workflows/ui/WorkflowConditionBuilder.tsx | 134 ++++++++++-------- 1 file changed, 77 insertions(+), 57 deletions(-) diff --git a/desktop/src/features/workflows/ui/WorkflowConditionBuilder.tsx b/desktop/src/features/workflows/ui/WorkflowConditionBuilder.tsx index 33c30ee95..f883d88df 100644 --- a/desktop/src/features/workflows/ui/WorkflowConditionBuilder.tsx +++ b/desktop/src/features/workflows/ui/WorkflowConditionBuilder.tsx @@ -5,12 +5,12 @@ import { useUsersBatchQuery } from "@/features/profile/hooks"; import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar"; import { useIdentityQuery } from "@/shared/api/hooks"; import type { Channel, UserProfileSummary } from "@/shared/api/types"; +import { cn } from "@/shared/lib/cn"; import { truncatePubkey } from "@/shared/lib/pubkey"; import { Input } from "@/shared/ui/input"; import { AuthorGridPicker } from "./AuthorGridPicker"; import { MessageIdPicker } from "./MessageIdPicker"; import { WorkflowEmojiField } from "./WorkflowEmojiField"; -import { FieldLabel, FormSelect } from "./workflowFormPrimitives"; import { buildConditionExpressions, conditionFieldsForTrigger, @@ -209,39 +209,86 @@ function ConditionEditorFields({ editor.webhookField.length > 0 && normalizeWebhookField(editor.webhookField) === null; const controlIdPrefix = `${idPrefix}-${editor.field}`; + const valueInput = ( + onChange({ ...editor, value: event.target.value })} + placeholder={ + editor.field === "webhook_field" + ? "Value to match" + : valuePlaceholder(editor.field) + } + value={editor.value} + /> + ); return (
-
- Match - - onChange({ - ...editor, - operator: operator as ConditionOperator, - }) - } - value={editor.operator} - > - {operatorOptions.map((operator) => ( - - ))} - -
+ id={`${controlIdPrefix}-value`} + knownPubkeys={knownAuthorPubkeys} + onChange={(pubkey) => onChange({ ...editor, value: pubkey })} + value={editor.value} + /> + ) : null} + +
+ Match +
+ {operatorOptions.map((operator) => { + const id = `${controlIdPrefix}-operator-${operator}`; + return ( +
+ onChange({ ...editor, operator })} + type="radio" + value={operator} + /> + +
+ ); + })} +
+
{editor.field === "webhook_field" ? (
- - JSON field name - ) : null} - {needsValue ? ( -
- - {editor.field === "webhook_field" - ? "Value" - : valueLabel(editor.field)} - - {editor.field === "trigger_author" ? ( - onChange({ ...editor, value: pubkey })} - value={editor.value} - /> - ) : editor.field === "trigger_emoji" ? ( + {needsValue && + editor.field !== "trigger_text" && + editor.field !== "trigger_author" ? ( +
+ {editor.field === "trigger_emoji" ? ( ) : ( - - onChange({ ...editor, value: event.target.value }) - } - placeholder={ - editor.field === "webhook_field" - ? "Value to match" - : valuePlaceholder(editor.field) - } - value={editor.value} - /> + valueInput )}
) : null} @@ -564,10 +586,8 @@ export function WorkflowConditionBuilder({ {activeEditor?.kind === "custom" ? (
- - Expression -