From 47957b41881e4d9c46b6b13a159f40beee60e133 Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Thu, 16 Oct 2025 19:56:30 +0200 Subject: [PATCH] feat: add quick edit button for actor types in properties panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a small edit icon button next to the "Actor Type" label in the RightPanel Actor Properties section that opens the NodeTypeConfigModal directly in edit mode for the selected actor's type. Changes: - Added edit icon button aligned to the right of "Actor Type" label - Opens existing NodeTypeConfigModal in edit mode for current type - Enhanced NodeTypeConfigModal to support initialEditingTypeId prop - Modal automatically enters edit mode when opened with a type ID - Fixed TypeScript error with showAdvancedByDefault prop This provides a convenient shortcut for editing actor types without navigating to the settings menu or left panel configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/components/Config/NodeTypeConfig.tsx | 18 +++++- src/components/Config/QuickAddTypeForm.tsx | 1 - src/components/Panels/RightPanel.tsx | 67 ++++++++++++++++++++-- 3 files changed, 79 insertions(+), 7 deletions(-) diff --git a/src/components/Config/NodeTypeConfig.tsx b/src/components/Config/NodeTypeConfig.tsx index a84946b..54b54b8 100644 --- a/src/components/Config/NodeTypeConfig.tsx +++ b/src/components/Config/NodeTypeConfig.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { useGraphWithHistory } from '../../hooks/useGraphWithHistory'; import { useConfirm } from '../../hooks/useConfirm'; import { useToastStore } from '../../stores/toastStore'; @@ -23,15 +23,29 @@ import type { NodeTypeConfig, NodeShape } from '../../types'; interface Props { isOpen: boolean; onClose: () => void; + initialEditingTypeId?: string | null; } -const NodeTypeConfigModal = ({ isOpen, onClose }: Props) => { +const NodeTypeConfigModal = ({ isOpen, onClose, initialEditingTypeId }: Props) => { const { nodeTypes, addNodeType, updateNodeType, deleteNodeType } = useGraphWithHistory(); const { confirm, ConfirmDialogComponent } = useConfirm(); const { showToast } = useToastStore(); const [editingType, setEditingType] = useState(null); + // Set editing type when initialEditingTypeId changes + useEffect(() => { + if (initialEditingTypeId && isOpen) { + const typeToEdit = nodeTypes.find(t => t.id === initialEditingTypeId); + if (typeToEdit) { + setEditingType(typeToEdit); + } + } else if (!isOpen) { + // Clear editing type when modal closes + setEditingType(null); + } + }, [initialEditingTypeId, isOpen, nodeTypes]); + const handleAddType = (type: { name: string; color: string; shape: NodeShape; icon: string; description: string }) => { const id = type.name.toLowerCase().replace(/\s+/g, '-'); diff --git a/src/components/Config/QuickAddTypeForm.tsx b/src/components/Config/QuickAddTypeForm.tsx index c7bb4d0..b1ad068 100644 --- a/src/components/Config/QuickAddTypeForm.tsx +++ b/src/components/Config/QuickAddTypeForm.tsx @@ -82,7 +82,6 @@ const QuickAddTypeForm = ({ onAdd }: Props) => { onKeyDown={handleKeyDown} nameInputRef={nameInputRef} autoFocusName={false} - showAdvancedByDefault={false} />