-
- Content
-
-
+
+
+ {editMode ? (
+ <>
+
+
+ >
+ ) : (
+
+ )}
+ {
+ // reset edit state when closing the modal
+ if (nodeData) {
+ const firstRow = nodeData.text?.[0];
+ const firstPrimitiveValue = typeof firstRow?.value === "string" || typeof firstRow?.value === "number" ? String(firstRow?.value) : undefined;
+ const inferredName =
+ nodeData.name ??
+ (firstRow && firstRow.key && firstPrimitiveValue ? firstPrimitiveValue : undefined) ??
+ firstRow?.key ??
+ nodeData.parentKey ??
+ firstPrimitiveValue ??
+ "";
+ setLocalName(inferredName ?? "");
+ setLocalColor(nodeData.color ?? "#3B82F6");
+ }
+ setEditMode(false);
+ onClose?.();
+ }}
+ />
+