pull/5370/head
Joseph Izang 9 months ago
parent aa0a6b68f7
commit cd3f599cd9
  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' import { FormattedMessage } from 'react-intl'
export type FileHoverIconsProps = { export type FileHoverIconsProps = {
isEditable?: boolean
file: any file: any
handleNewFolderOp?: any handleNewFolderOp?: any
handleNewFileOp?: any handleNewFileOp?: any
renamePathOp?: (path: string, type: string) => void renamePathOp?: (path: string, type: string, isNew?: boolean) => void
deletePathOp?: (path: string | string[]) => void | Promise<void> deletePathOp?: (path: string | string[]) => void | Promise<void>
} }
@ -67,9 +66,9 @@ export function FileHoverIcons(props: FileHoverIconsProps) {
> >
<span <span
className="far fa-pen fa-1x remixui_icons mr-2" className="far fa-pen fa-1x remixui_icons mr-2"
onClick={async (e) => { onClick={(e) => {
e.stopPropagation() e.stopPropagation()
await props.renamePathOp(props.file.path, props.file.type) props.renamePathOp(props.file.path, props.file.type)
}} }}
style={{ cursor: mouseOver ? 'pointer' : 'default' }} style={{ cursor: mouseOver ? 'pointer' : 'default' }}
onMouseEnter={(e) => setMouseOver(true)} onMouseEnter={(e) => setMouseOver(true)}

@ -408,8 +408,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
createNewFile={props.createNewFile} createNewFile={props.createNewFile}
createNewFolder={props.createNewFolder} createNewFolder={props.createNewFolder}
deletePath={deletePath} deletePath={deletePath}
renamePath={renamePath} editPath={props.editModeOn}
editModeOn={props.editModeOn}
/> />
</div> </div>
</div> </div>

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

Loading…
Cancel
Save