pull/4446/head
Joseph Izang 9 months ago
parent ee5dccd5a2
commit 5f5e861860
  1. 7
      libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx
  2. 3
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  3. 8
      libs/remix-ui/workspace/src/lib/components/flat-tree.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<void>
}
@ -67,9 +66,9 @@ export function FileHoverIcons(props: FileHoverIconsProps) {
>
<span
className="far fa-pen fa-1x remixui_icons mr-2"
onClick={async (e) => {
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)}

@ -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}
/>
</div>
</div>

@ -41,8 +41,7 @@ interface FlatTreeProps {
createNewFile?: any
createNewFolder?: any
deletePath?: (path: string | string[]) => void | Promise<void>
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<string>('')
const [mouseOverTarget, setMouseOverTarget] = useState<{
path: string,
@ -190,8 +189,7 @@ export const FlatTree = (props: FlatTreeProps) => {
<div>
<FileHoverIcons
file={file}
isEditable={true}
renamePathOp={props.editModeOn}
renamePathOp={props.editPath}
deletePathOp={deletePath}
handleNewFileOp={props.createNewFile}
handleNewFolderOp={props.createNewFolder}

Loading…
Cancel
Save