diff options
| author | blackhao <13851610112@163.com> | 2025-12-10 22:26:41 -0600 |
|---|---|---|
| committer | blackhao <13851610112@163.com> | 2025-12-10 22:26:41 -0600 |
| commit | f47ea989671ac53958a226f9ff419423863c596a (patch) | |
| tree | b9b6668219ecffca38d4735af43a5b09d5ea9482 /frontend/src | |
| parent | 180df64e94f00d05db9453ac20322455c96288e6 (diff) | |
fix: hide .json extension when renaming blueprints
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/components/LeftSidebar.tsx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/frontend/src/components/LeftSidebar.tsx b/frontend/src/components/LeftSidebar.tsx index 4a0ac7b..668f75a 100644 --- a/frontend/src/components/LeftSidebar.tsx +++ b/frontend/src/components/LeftSidebar.tsx @@ -206,9 +206,16 @@ const LeftSidebar: React.FC<LeftSidebarProps> = ({ isOpen, onToggle }) => { }; const handleRename = async (item: FSItem) => { - const newName = promptName('Rename to', item.name); - if (!newName || newName === item.name) return; - await renameProjectItem(item.path, newName); + // For .json files, show name without extension + const isJsonFile = item.type === 'file' && item.name.endsWith('.json'); + const displayName = isJsonFile ? item.name.replace(/\.json$/, '') : item.name; + + const newName = promptName('Rename to', displayName); + if (!newName || newName === displayName) return; + + // Add .json extension back for json files + const finalName = isJsonFile ? `${newName}.json` : newName; + await renameProjectItem(item.path, finalName); }; const handleDelete = async (item: FSItem) => { |
