| 84 | }, [isEditing]); |
| 85 | |
| 86 | const handleSubmitRename = () => { |
| 87 | const trimmed = editValue.trim(); |
| 88 | if (trimmed && trimmed !== section.name) { |
| 89 | onRename(trimmed); |
| 90 | } else if (onAutoCreateRenameCancel) { |
| 91 | // Blur/submit with no committed rename should exit auto-create mode, |
| 92 | // otherwise a later Escape can still route through abandon/delete. |
| 93 | onAutoCreateRenameCancel(); |
| 94 | setEditValue(section.name); |
| 95 | } else { |
| 96 | setEditValue(section.name); |
| 97 | } |
| 98 | setHasEditedName(false); |
| 99 | setIsEditing(false); |
| 100 | }; |
| 101 | |
| 102 | const sectionColor = resolveSectionColor(section.color); |
| 103 | |