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 49b4584ca1..70d3c47e78 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 @@ -17,82 +17,82 @@ export function FileHoverIcons(props: FileHoverIconsProps) { return ( <> - {(props.hover && !props.isEditable) &&
+ {(!props.hover && !props.isEditable) &&
{ props.file.isDirectory ? ( <> - } tooltipId={`filePanel.edit.${props.file.path}`} tooltipClasses="text-nowrap" - > - { - e.stopPropagation() - console.log(props) - await props.handleNewFolderOp(props.file.path) - console.log('clicked on folder icon') - }} - > - - */} + { + e.stopPropagation() + console.log(props) + await props.handleNewFolderOp(props.file.path) + console.log('clicked on folder icon') + }} + > + {/* */} + {/* } tooltipId={`fileExplorer.edit.${props.file.path}`} tooltipClasses="text-nowrap" - > - { - e.stopPropagation() - await props.handleNewFileOp(props.file.path) - console.log('clicked on file icon') - }} - > - + > */} + { + e.stopPropagation() + await props.handleNewFileOp(props.file.path) + console.log('clicked on file icon') + }} + > + {/* */} ) : null } - } tooltipId={`fileExplorer.edit.${props.file.path}`} tooltipClasses="text-nowrap" - > - { - e.stopPropagation() - console.log(props) - console.log(e) - await props.renamePathOp(props.file.path, props.file.type) - console.log('clicked on edit icon') - }} - > - - */} + { + e.stopPropagation() + console.log(props) + console.log(e) + await props.renamePathOp(props.file.path, props.file.type) + console.log('clicked on edit icon') + }} + > + {/* */} + {/* } tooltipId={`fileExplorer.edit.${props.file.path}`} tooltipClasses="text-nowrap" - > - { - e.stopPropagation() - console.log(props) - console.log(e) - console.log('clicked on trash icon') - await props.deletePathOp(props.file.path) - }} - > - + > */} + { + e.stopPropagation() + console.log(props) + console.log(e) + console.log('clicked on trash icon') + await props.deletePathOp(props.file.path) + }} + > + {/* */}
} 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 39e20428d4..9eca0e4c7d 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState, useRef, SyntheticEvent, useTransition } from 'react' // eslint-disable-line +import React, { useEffect, useState, useRef, SyntheticEvent } from 'react' // eslint-disable-line import { useIntl } from 'react-intl' import { TreeView } from '@remix-ui/tree-view' // eslint-disable-line import { FileExplorerMenu } from './file-explorer-menu' // eslint-disable-line @@ -27,12 +27,13 @@ export const FileExplorer = (props: FileExplorerProps) => { handleContextMenu, handleNewFileInput, handleNewFolderInput, + deletePath, uploadFile, uploadFolder, fileState } = props const [state, setState] = useState(workspaceState) - const [isPending, startTransition] = useTransition(); + // const [isPending, startTransition] = useTransition(); const treeRef = useRef(null) useEffect(() => { @@ -404,6 +405,8 @@ export const FileExplorer = (props: FileExplorerProps) => { moveFile={handleFileMove} moveFolder={handleFolderMove} handleClickFolder={handleClickFolder} + createNewFile={handleNewFileInput} + createNewFolder={handleNewFolderInput} />
diff --git a/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx b/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx index e1d7fc72c5..de02b36084 100644 --- a/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx +++ b/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx @@ -1,4 +1,4 @@ -import React, { SyntheticEvent, startTransition, useEffect, useRef, useState } from 'react' +import React, { SyntheticEvent, useEffect, useRef, useState } from 'react' import { FileType } from '../types' import { getEventTarget } from '../utils/getEventTarget' import { extractParentFromKey } from '@remix-ui/helper' @@ -36,7 +36,7 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => { setFolderToOpen(null) } if (dragDestination && dragDestination.isDirectory && !expandPath.includes(dragDestination.path) && folderToOpen !== dragDestination.path && props.handleClickFolder) { - + setFolderToOpen(dragDestination.path) timer && clearTimeout(timer) setTimer( @@ -84,4 +84,4 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => { onDrop={onDrop} onDragOver={onDragOver} className="d-flex h-100" >{props.children}) -} \ No newline at end of file +} 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 a96f514a86..16d76c9bc2 100644 --- a/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx +++ b/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx @@ -8,6 +8,7 @@ import { FlatTreeDrop } from './flat-tree-drop'; import { getEventTarget } from '../utils/getEventTarget'; import { fileDecoration, FileDecorationIcons } from '@remix-ui/file-decorators'; import { FileHoverIcons } from './file-explorer-hovericons'; +import { deletePath } from '../actions'; export default function useOnScreen(ref: RefObject) { @@ -37,6 +38,10 @@ interface FlatTreeProps { moveFile: (dest: string, src: string) => void moveFolder: (dest: string, src: string) => void fileState: fileDecoration[] + createNewFile?: any + createNewFolder?: any + deletePath?: (path: string | string[]) => void | Promise + renamePath?: (path: string, newName: string) => void | Promise } let mouseTimer: any = { @@ -45,7 +50,7 @@ let mouseTimer: any = { } export const FlatTree = (props: FlatTreeProps) => { - const { files, flatTree, expandPath, focusEdit, editModeOff, handleTreeClick, moveFile, moveFolder, fileState, focusElement, handleClickFolder } = props + const { files, flatTree, expandPath, focusEdit, editModeOff, handleTreeClick, moveFile, moveFolder, fileState, focusElement, handleClickFolder, deletePath, renamePath } = props const [hover, setHover] = useState('') const [mouseOverTarget, setMouseOverTarget] = useState<{ path: string, @@ -211,7 +216,9 @@ export const FlatTree = (props: FlatTreeProps) => {
-
{getFileStateIcons(file)} +
+ +
{getFileStateIcons(file)}
} diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 400aa1de2c..c9785841e5 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -796,7 +796,7 @@ export function Workspace() { +