circular dependency fixed

pull/2620/head
Seth Samuel 2 years ago
parent 4f9972e206
commit 14bd76ea98
  1. 10
      libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx
  2. 3
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  3. 4
      libs/remix-ui/workspace/src/lib/components/file-render.tsx

@ -1,4 +1,3 @@
import { FileType } from "libs/remix-ui/workspace/src/lib/types";
import React, { import React, {
createContext, createContext,
ReactNode, ReactNode,
@ -7,6 +6,15 @@ import React, {
useState, useState,
} from "react"; } from "react";
export interface FileType {
path: string,
name: string,
isDirectory: boolean,
type: 'folder' | 'file' | 'gist',
child?: File[]
}
interface MoveContextType { interface MoveContextType {
dragged: string; dragged: string;
isDraggable?: boolean; isDraggable?: boolean;

@ -10,7 +10,7 @@ import '../css/file-explorer.css'
import { checkSpecialChars, extractNameFromKey, extractParentFromKey, joinPath } from '@remix-ui/helper' import { checkSpecialChars, extractNameFromKey, extractParentFromKey, joinPath } from '@remix-ui/helper'
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
import { FileRender } from './file-render' import { FileRender } from './file-render'
import {Drag} from "@remix-ui/drag-n-drop" import { Drag } from "@remix-ui/drag-n-drop"
export const FileExplorer = (props: FileExplorerProps) => { export const FileExplorer = (props: FileExplorerProps) => {
const { name, contextMenuItems, removedContextMenuItems, files, fileState } = props const { name, contextMenuItems, removedContextMenuItems, files, fileState } = props
@ -37,7 +37,6 @@ export const FileExplorer = (props: FileExplorerProps) => {
}) })
const [canPaste, setCanPaste] = useState(false) const [canPaste, setCanPaste] = useState(false)
const treeRef = useRef<HTMLDivElement>(null) const treeRef = useRef<HTMLDivElement>(null)
const [dragged, setDragged] = useState<string>("")
useEffect(() => { useEffect(() => {
if (contextMenuItems) { if (contextMenuItems) {

@ -82,7 +82,9 @@ export const FileRender = (props: RenderFileProps) => {
iconX='pr-3 fa fa-folder' iconX='pr-3 fa fa-folder'
iconY='pr-3 fa fa-folder-open' iconY='pr-3 fa fa-folder-open'
key={`${file.path + props.index}`} key={`${file.path + props.index}`}
label={<FileLabel fileDecorations={props.fileDecorations} file={file} focusEdit={props.focusEdit} editModeOff={props.editModeOff} />} label={<Draggable isDraggable={props.focusEdit.element!==null} file={file} expandedPath={props.expandPath} handleClickFolder={props.handleClickFolder}>
<FileLabel fileDecorations={props.fileDecorations} file={file} focusEdit={props.focusEdit} editModeOff={props.editModeOff} />
</Draggable>}
onClick={handleFolderClick} onClick={handleFolderClick}
onContextMenu={handleContextMenu} onContextMenu={handleContextMenu}
labelClass={labelClass} labelClass={labelClass}

Loading…
Cancel
Save