add props, make icons visible.

pull/4446/head
Joseph Izang 10 months ago
parent 2c28bbff48
commit d0598e2d73
  1. 26
      libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx
  2. 7
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  3. 2
      libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx
  4. 11
      libs/remix-ui/workspace/src/lib/components/flat-tree.tsx
  5. 1
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  6. 1
      libs/remix-ui/workspace/src/lib/types/index.ts

@ -17,17 +17,17 @@ export function FileHoverIcons(props: FileHoverIconsProps) {
return ( return (
<> <>
{(props.hover && !props.isEditable) && <div className={`d-flex flex-row align-items-center`} style={{ marginLeft: '6rem' }}> {(!props.hover && !props.isEditable) && <div className="d-flex flex-row align-items-center" style={{ marginLeft: '6rem' }}>
{ {
props.file.isDirectory ? ( props.file.isDirectory ? (
<> <>
<CustomTooltip {/* <CustomTooltip
placement="right-start" placement="right-start"
delay={{show: 1000, hide: 0}} delay={{show: 1000, hide: 0}}
tooltipText={<FormattedMessage id="filePanel.edit" />} tooltipText={<FormattedMessage id="filePanel.edit" />}
tooltipId={`filePanel.edit.${props.file.path}`} tooltipId={`filePanel.edit.${props.file.path}`}
tooltipClasses="text-nowrap" tooltipClasses="text-nowrap"
> > */}
<span <span
className="far fa-folder fa-1x remixui_icons_space remixui_icons" className="far fa-folder fa-1x remixui_icons_space remixui_icons"
onClick={async (e) => { onClick={async (e) => {
@ -37,14 +37,14 @@ export function FileHoverIcons(props: FileHoverIconsProps) {
console.log('clicked on folder icon') console.log('clicked on folder icon')
}} }}
></span> ></span>
</CustomTooltip> {/* </CustomTooltip> */}
<CustomTooltip {/* <CustomTooltip
placement="right-start" placement="right-start"
delay={{show: 1000, hide: 0}} delay={{show: 1000, hide: 0}}
tooltipText={<FormattedMessage id="fileExplorer.edit" />} tooltipText={<FormattedMessage id="fileExplorer.edit" />}
tooltipId={`fileExplorer.edit.${props.file.path}`} tooltipId={`fileExplorer.edit.${props.file.path}`}
tooltipClasses="text-nowrap" tooltipClasses="text-nowrap"
> > */}
<span <span
className="far fa-file fa-1x remixui_icons remixui_icons_space" className="far fa-file fa-1x remixui_icons remixui_icons_space"
onClick={async (e) => { onClick={async (e) => {
@ -53,17 +53,17 @@ export function FileHoverIcons(props: FileHoverIconsProps) {
console.log('clicked on file icon') console.log('clicked on file icon')
}} }}
></span> ></span>
</CustomTooltip> {/* </CustomTooltip> */}
</> </>
) : null ) : null
} }
<CustomTooltip {/* <CustomTooltip
placement="right-start" placement="right-start"
delay={{show: 1000, hide: 0}} delay={{show: 1000, hide: 0}}
tooltipText={<FormattedMessage id="fileExplorer.edit" />} tooltipText={<FormattedMessage id="fileExplorer.edit" />}
tooltipId={`fileExplorer.edit.${props.file.path}`} tooltipId={`fileExplorer.edit.${props.file.path}`}
tooltipClasses="text-nowrap" tooltipClasses="text-nowrap"
> > */}
<span <span
className="far fa-pen fa-1x remixui_icons remixui_icons_space" className="far fa-pen fa-1x remixui_icons remixui_icons_space"
onClick={async (e) => { onClick={async (e) => {
@ -74,14 +74,14 @@ export function FileHoverIcons(props: FileHoverIconsProps) {
console.log('clicked on edit icon') console.log('clicked on edit icon')
}} }}
></span> ></span>
</CustomTooltip> {/* </CustomTooltip> */}
<CustomTooltip {/* <CustomTooltip
placement="right-start" placement="right-start"
delay={{show: 1000, hide: 0}} delay={{show: 1000, hide: 0}}
tooltipText={<FormattedMessage id="fileExplorer.edit" />} tooltipText={<FormattedMessage id="fileExplorer.edit" />}
tooltipId={`fileExplorer.edit.${props.file.path}`} tooltipId={`fileExplorer.edit.${props.file.path}`}
tooltipClasses="text-nowrap" tooltipClasses="text-nowrap"
> > */}
<span <span
className="far fa-trash fa-1x remixui_icons remixui_icons_space" className="far fa-trash fa-1x remixui_icons remixui_icons_space"
onClick={async (e) => { onClick={async (e) => {
@ -92,7 +92,7 @@ export function FileHoverIcons(props: FileHoverIconsProps) {
await props.deletePathOp(props.file.path) await props.deletePathOp(props.file.path)
}} }}
></span> ></span>
</CustomTooltip> {/* </CustomTooltip> */}
</div> </div>
} }
</> </>

@ -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 { useIntl } from 'react-intl'
import { TreeView } from '@remix-ui/tree-view' // eslint-disable-line import { TreeView } from '@remix-ui/tree-view' // eslint-disable-line
import { FileExplorerMenu } from './file-explorer-menu' // eslint-disable-line import { FileExplorerMenu } from './file-explorer-menu' // eslint-disable-line
@ -27,12 +27,13 @@ export const FileExplorer = (props: FileExplorerProps) => {
handleContextMenu, handleContextMenu,
handleNewFileInput, handleNewFileInput,
handleNewFolderInput, handleNewFolderInput,
deletePath,
uploadFile, uploadFile,
uploadFolder, uploadFolder,
fileState fileState
} = props } = props
const [state, setState] = useState<WorkSpaceState>(workspaceState) const [state, setState] = useState<WorkSpaceState>(workspaceState)
const [isPending, startTransition] = useTransition(); // const [isPending, startTransition] = useTransition();
const treeRef = useRef<HTMLDivElement>(null) const treeRef = useRef<HTMLDivElement>(null)
useEffect(() => { useEffect(() => {
@ -404,6 +405,8 @@ export const FileExplorer = (props: FileExplorerProps) => {
moveFile={handleFileMove} moveFile={handleFileMove}
moveFolder={handleFolderMove} moveFolder={handleFolderMove}
handleClickFolder={handleClickFolder} handleClickFolder={handleClickFolder}
createNewFile={handleNewFileInput}
createNewFolder={handleNewFolderInput}
/> />
</div> </div>
</div> </div>

@ -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 { FileType } from '../types'
import { getEventTarget } from '../utils/getEventTarget' import { getEventTarget } from '../utils/getEventTarget'
import { extractParentFromKey } from '@remix-ui/helper' import { extractParentFromKey } from '@remix-ui/helper'

@ -8,6 +8,7 @@ import { FlatTreeDrop } from './flat-tree-drop';
import { getEventTarget } from '../utils/getEventTarget'; import { getEventTarget } from '../utils/getEventTarget';
import { fileDecoration, FileDecorationIcons } from '@remix-ui/file-decorators'; import { fileDecoration, FileDecorationIcons } from '@remix-ui/file-decorators';
import { FileHoverIcons } from './file-explorer-hovericons'; import { FileHoverIcons } from './file-explorer-hovericons';
import { deletePath } from '../actions';
export default function useOnScreen(ref: RefObject<HTMLElement>) { export default function useOnScreen(ref: RefObject<HTMLElement>) {
@ -37,6 +38,10 @@ interface FlatTreeProps {
moveFile: (dest: string, src: string) => void moveFile: (dest: string, src: string) => void
moveFolder: (dest: string, src: string) => void moveFolder: (dest: string, src: string) => void
fileState: fileDecoration[] fileState: fileDecoration[]
createNewFile?: any
createNewFolder?: any
deletePath?: (path: string | string[]) => void | Promise<void>
renamePath?: (path: string, newName: string) => void | Promise<void>
} }
let mouseTimer: any = { let mouseTimer: any = {
@ -45,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 } = props const { files, flatTree, expandPath, focusEdit, editModeOff, handleTreeClick, moveFile, moveFolder, fileState, focusElement, handleClickFolder, deletePath, renamePath } = props
const [hover, setHover] = useState<string>('') const [hover, setHover] = useState<string>('')
const [mouseOverTarget, setMouseOverTarget] = useState<{ const [mouseOverTarget, setMouseOverTarget] = useState<{
path: string, path: string,
@ -211,7 +216,9 @@ export const FlatTree = (props: FlatTreeProps) => {
</div> </div>
<div className="d-flex flex-row gap-1"> <div className="d-flex flex-row gap-1">
<div><FileHoverIcons file={file} /></div>{getFileStateIcons(file)} <div>
<FileHoverIcons file={file} />
</div> {getFileStateIcons(file)}
</div> </div>
</> </>
} }

@ -1188,6 +1188,7 @@ export function Workspace() {
editModeOn={editModeOn} editModeOn={editModeOn}
handleNewFileInput={handleNewFileInput} handleNewFileInput={handleNewFileInput}
handleNewFolderInput={handleNewFolderInput} handleNewFolderInput={handleNewFolderInput}
deletePath={deletePath}
dragStatus={dragStatus} dragStatus={dragStatus}
/> />
)} )}

@ -130,6 +130,7 @@ export interface FileExplorerProps {
toGist: (path?: string, type?: string) => void toGist: (path?: string, type?: string) => void
handleNewFileInput: (parentFolder?: string) => Promise<void> handleNewFileInput: (parentFolder?: string) => Promise<void>
handleNewFolderInput: (parentFolder?: string) => Promise<void> handleNewFolderInput: (parentFolder?: string) => Promise<void>
deletePath?: (path: string[]) => Promise<void>
dragStatus: (status: boolean) => void dragStatus: (status: boolean) => void
} }

Loading…
Cancel
Save