mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 23:44:22 +00:00
Add rename file functionality with modal support
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
IconGitPullRequest,
|
||||
IconGitCommit,
|
||||
IconUpload,
|
||||
IconEdit,
|
||||
} from '@tabler/icons-react';
|
||||
import { useModalContext } from '../../contexts/ModalContext';
|
||||
import { useWorkspace } from '../../hooks/useWorkspace';
|
||||
@@ -27,6 +28,7 @@ const FileActions: React.FC<FileActionsProps> = ({
|
||||
setNewFileModalVisible,
|
||||
setDeleteFileModalVisible,
|
||||
setCommitMessageModalVisible,
|
||||
setRenameFileModalVisible,
|
||||
} = useModalContext();
|
||||
|
||||
const { handleUpload } = useFileOperations();
|
||||
@@ -36,6 +38,7 @@ const FileActions: React.FC<FileActionsProps> = ({
|
||||
|
||||
const handleCreateFile = (): void => setNewFileModalVisible(true);
|
||||
const handleDeleteFile = (): void => setDeleteFileModalVisible(true);
|
||||
const handleRenameFile = (): void => setRenameFileModalVisible(true);
|
||||
const handleCommitAndPush = (): void => setCommitMessageModalVisible(true);
|
||||
|
||||
const handleUploadClick = (): void => {
|
||||
@@ -91,6 +94,21 @@ const FileActions: React.FC<FileActionsProps> = ({
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip
|
||||
label={selectedFile ? 'Rename current file' : 'No file selected'}
|
||||
>
|
||||
<ActionIcon
|
||||
variant="default"
|
||||
size="md"
|
||||
onClick={handleRenameFile}
|
||||
disabled={!selectedFile}
|
||||
aria-label="Rename current file"
|
||||
data-testid="rename-file-button"
|
||||
>
|
||||
<IconEdit size={16} />
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip
|
||||
label={selectedFile ? 'Delete current file' : 'No file selected'}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user