From 48a7c43e23b90e409d5aca7efe7ef6780e041061 Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 28 Apr 2026 07:42:30 -0500 Subject: [PATCH] PAP-2605: unify routine variables container and add help modal Wrap the variables editor in a single rounded container so the "Variables" header and the per-variable cards share one border with internal dividers, instead of stacking as two visually separate containers when expanded. Add a help button to the variable instructions hint that opens a modal explaining custom {{variable_name}} placeholders and the built-in {{date}} and {{timestamp}} variables. Co-Authored-By: Paperclip --- ui/src/components/RoutineVariablesEditor.tsx | 121 +++++++++++++++++-- 1 file changed, 113 insertions(+), 8 deletions(-) diff --git a/ui/src/components/RoutineVariablesEditor.tsx b/ui/src/components/RoutineVariablesEditor.tsx index f6ecd32259c..cae1b0bc75d 100644 --- a/ui/src/components/RoutineVariablesEditor.tsx +++ b/ui/src/components/RoutineVariablesEditor.tsx @@ -1,8 +1,15 @@ import { useEffect, useMemo, useState } from "react"; -import { ChevronDown, ChevronRight } from "lucide-react"; +import { ChevronDown, ChevronRight, HelpCircle } from "lucide-react"; import { syncRoutineVariablesWithTemplate, type RoutineVariable } from "@paperclipai/shared"; import { Badge } from "@/components/ui/badge"; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { @@ -65,8 +72,8 @@ export function RoutineVariablesEditor({ } return ( - - + +

Variables

@@ -75,9 +82,9 @@ export function RoutineVariablesEditor({

{open ? : }
- + {syncedVariables.map((variable) => ( -
+
{`{{${variable.name}}}`} @@ -225,10 +232,108 @@ export function RoutineVariablesEditor({ ); } +type BuiltinVariableDoc = { + name: string; + example: string; + description: string; +}; + +const BUILTIN_VARIABLE_DOCS: BuiltinVariableDoc[] = [ + { + name: "date", + example: "2026-04-28", + description: "Current date in YYYY-MM-DD format (UTC) at the time the routine runs.", + }, + { + name: "timestamp", + example: "April 28, 2026 at 12:17 PM UTC", + description: "Human-readable date and time (UTC) at the time the routine runs.", + }, +]; + export function RoutineVariablesHint() { + const [helpOpen, setHelpOpen] = useState(false); + return ( -
- Use `{"{{variable_name}}"}` placeholders in the instructions to prompt for inputs when the routine runs. -
+ <> +
+ + Use `{"{{variable_name}}"}` placeholders in the instructions to prompt for inputs when the routine runs. + + +
+ + + + + Routine variables + + How to prompt for inputs and which variables Paperclip fills in automatically. + + + +
+
+

+ Custom variables +

+

+ Type{" "} + + {"{{variable_name}}"} + {" "} + anywhere in the title or instructions. Paperclip detects each placeholder, lists it + under Variables, and prompts + for a value before each run. +

+
    +
  • Names must start with a letter and may use letters, numbers, and underscores.
  • +
  • Pick a type (text, textarea, number, boolean, select), default value, and whether it is required.
  • +
  • The same name reused across the title and instructions is treated as one variable.
  • +
+
+ +
+

+ Built-in variables +

+

+ These are filled in automatically — no setup needed and they will not appear in the + Variables list. +

+
+ + + + + + + + + + {BUILTIN_VARIABLE_DOCS.map((entry) => ( + + + + + + ))} + +
PlaceholderExampleDescription
+ {`{{${entry.name}}}`} + {entry.example}{entry.description}
+
+
+
+
+
+ ); }