Skip to content

Commit 869144d

Browse files
committed
Add select and rename now goes to one renamed
1 parent 010f992 commit 869144d

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/reactComponents/FileManageModal.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import * as React from 'react';
2525
import * as commonStorage from '../storage/common_storage';
2626
import * as storageModule from '../storage/module';
2727
import * as storageProject from '../storage/project';
28-
import {EditOutlined, DeleteOutlined, CopyOutlined} from '@ant-design/icons';
28+
import {EditOutlined, DeleteOutlined, CopyOutlined, SelectOutlined} from '@ant-design/icons';
2929
import ClassNameComponent from './ClassNameComponent';
3030

3131
/** Represents a module in the file management system. */
@@ -54,7 +54,7 @@ const DEFAULT_PAGE_SIZE = 5;
5454
const MODAL_WIDTH = 800;
5555

5656
/** Actions column width in pixels. */
57-
const ACTIONS_COLUMN_WIDTH = 120;
57+
const ACTIONS_COLUMN_WIDTH = 160;
5858

5959
/**
6060
* Modal component for managing files (mechanisms and opmodes) within a project.
@@ -125,12 +125,20 @@ export default function FileManageModal(props: FileManageModalProps) {
125125

126126
setModules(newModules);
127127
triggerProjectUpdate();
128+
129+
// Close the rename modal first
130+
setRenameModalOpen(false);
131+
132+
// Automatically select and open the newly created module
133+
props.gotoTab(newModulePath);
134+
props.onClose();
135+
128136
} catch (error) {
129137
console.error('Error renaming module:', error);
130138
props.setAlertErrorMessage(t('FAILED_TO_RENAME_MODULE'));
139+
setRenameModalOpen(false);
131140
}
132141

133-
setRenameModalOpen(false);
134142
};
135143

136144
/** Handles copying a module. */
@@ -276,6 +284,14 @@ export default function FileManageModal(props: FileManageModalProps) {
276284
width: ACTIONS_COLUMN_WIDTH,
277285
render: (_, record: Module) => (
278286
<Antd.Space size="small">
287+
<Antd.Tooltip title={t('Select')}>
288+
<Antd.Button
289+
type="text"
290+
size="small"
291+
icon={<SelectOutlined />}
292+
onClick={() => handleRowDoubleClick(record)}
293+
/>
294+
</Antd.Tooltip>
279295
<Antd.Tooltip title={t('RENAME')}>
280296
<Antd.Button
281297
type="text"

0 commit comments

Comments
 (0)