Support routine variables in titles

This commit is contained in:
dotta 2026-04-07 16:31:14 -05:00
parent 372421ef0b
commit 1de5fb9316
7 changed files with 41 additions and 17 deletions

View file

@ -36,18 +36,20 @@ function updateVariableList(
}
export function RoutineVariablesEditor({
title,
description,
value,
onChange,
}: {
title: string;
description: string;
value: RoutineVariable[];
onChange: (value: RoutineVariable[]) => void;
}) {
const [open, setOpen] = useState(true);
const syncedVariables = useMemo(
() => syncRoutineVariablesWithTemplate(description, value),
[description, value],
() => syncRoutineVariablesWithTemplate([title, description], value),
[description, title, value],
);
const syncedSignature = serializeVariables(syncedVariables);
const currentSignature = serializeVariables(value);
@ -68,7 +70,7 @@ export function RoutineVariablesEditor({
<div>
<p className="text-sm font-medium">Variables</p>
<p className="text-xs text-muted-foreground">
Detected from `{"{{name}}"}` placeholders in the routine instructions.
Detected from `{"{{name}}"}` placeholders in the routine title and instructions.
</p>
</div>
{open ? <ChevronDown className="h-4 w-4 text-muted-foreground" /> : <ChevronRight className="h-4 w-4 text-muted-foreground" />}