From 5f5e861860393ed2fea7e40848ca5d3e7ac901d4 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 14 Feb 2024 09:16:44 +0100 Subject: [PATCH] fix rename --- .../src/lib/components/file-explorer-hovericons.tsx | 7 +++---- .../workspace/src/lib/components/file-explorer.tsx | 3 +-- libs/remix-ui/workspace/src/lib/components/flat-tree.tsx | 8 +++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx index c3d97ce4c1..c6b299f66f 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx @@ -3,11 +3,10 @@ import { CustomTooltip } from '@remix-ui/helper' import { FormattedMessage } from 'react-intl' export type FileHoverIconsProps = { - isEditable?: boolean file: any handleNewFolderOp?: any handleNewFileOp?: any - renamePathOp?: (path: string, type: string) => void + renamePathOp?: (path: string, type: string, isNew?: boolean) => void deletePathOp?: (path: string | string[]) => void | Promise } @@ -67,9 +66,9 @@ export function FileHoverIcons(props: FileHoverIconsProps) { > { + onClick={(e) => { e.stopPropagation() - await props.renamePathOp(props.file.path, props.file.type) + props.renamePathOp(props.file.path, props.file.type) }} style={{ cursor: mouseOver ? 'pointer' : 'default' }} onMouseEnter={(e) => setMouseOver(true)} diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 0b1113940f..2f818fc9f6 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -408,8 +408,7 @@ export const FileExplorer = (props: FileExplorerProps) => { createNewFile={props.createNewFile} createNewFolder={props.createNewFolder} deletePath={deletePath} - renamePath={renamePath} - editModeOn={props.editModeOn} + editPath={props.editModeOn} /> diff --git a/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx b/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx index 6f4acfd8b6..4bdddffe5b 100644 --- a/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx +++ b/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx @@ -41,8 +41,7 @@ interface FlatTreeProps { createNewFile?: any createNewFolder?: any deletePath?: (path: string | string[]) => void | Promise - renamePath?: (path: string, type: string) => void - editModeOn?: (path: string, type: string, isNew?: boolean) => void + editPath?: (path: string, type: string, isNew?: boolean) => void } let mouseTimer: any = { @@ -51,7 +50,7 @@ let mouseTimer: any = { } export const FlatTree = (props: FlatTreeProps) => { - const { files, flatTree, expandPath, focusEdit, editModeOff, handleTreeClick, moveFile, moveFolder, fileState, focusElement, handleClickFolder, deletePath, renamePath } = props + const { files, flatTree, expandPath, focusEdit, editModeOff, handleTreeClick, moveFile, moveFolder, fileState, focusElement, handleClickFolder, deletePath, editPath } = props const [hover, setHover] = useState('') const [mouseOverTarget, setMouseOverTarget] = useState<{ path: string, @@ -190,8 +189,7 @@ export const FlatTree = (props: FlatTreeProps) => {