feat: add keyboard shortcut for save

This commit is contained in:
Abhishek Kumar 2026-01-02 16:02:46 +05:30
parent 6f34433e00
commit fec8da9d20
10 changed files with 357 additions and 127 deletions

View file

@ -1,6 +1,6 @@
import { NodeProps, NodeToolbar, Position } from "@xyflow/react";
import { Edit, Play, Wrench } from "lucide-react";
import { memo, useEffect, useState } from "react";
import { memo, useEffect, useMemo, useState } from "react";
import { useWorkflow } from "@/app/workflow/[workflowId]/contexts/WorkflowContext";
import { ToolBadges } from "@/components/flow/ToolBadges";
@ -58,6 +58,14 @@ export const StartCall = memo(({ data, selected, id }: StartCallNodeProps) => {
const [delayedStartDuration, setDelayedStartDuration] = useState(data.delayed_start_duration ?? 2);
const [toolUuids, setToolUuids] = useState<string[]>(data.tool_uuids ?? []);
// Compute if form has unsaved changes (only check prompt, name)
const isDirty = useMemo(() => {
return (
prompt !== (data.prompt ?? "") ||
name !== (data.name ?? "")
);
}, [prompt, name, data]);
const handleSave = async () => {
handleSaveNodeData({
...data,
@ -146,6 +154,7 @@ export const StartCall = memo(({ data, selected, id }: StartCallNodeProps) => {
nodeData={data}
title="Start Call"
onSave={handleSave}
isDirty={isDirty}
>
{open && (
<StartCallEditForm