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}
+
+
+
+
+
+ ); }